I am trying to run my Django Server with python 3.4.3 and have been scratching my head on this for a while. The commands I have tried so far, and their error messages, are:
pip3.4 install MySQLdb (No matching distribution found for mysqldb)
pip3.4 install mysql-python (ImportError: No module named 'ConfigParser')
pip3.4 install configparser
pip install ConfigParser
File "/tmp/pip-build-mcfc7tj3/ConfigParser/configparser.py", line 397
_KEYCRE = re.compile(ur"%\(([^)]+)\)s")
^
SyntaxError: invalid syntax
pip3.4 install mysqlclient
File "/tmp/pip-build-s41j0x_s/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
sudo yum install python3-dev libmysqlclient-dev
No package python3-dev available.
No package libmysqlclient-dev available.
but still cannot get it installed. What should I do from here?
Notes:
Running python3.4 manage.py runserver threw
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'
解决方案
MySQLdb is not supported on Python 3.4 - you need to use an alternative driver
python-dev and mysql-dev are package names for the apt package system; which is used by debian, ubuntu and its clones/variants.
On CentOS you need the rpm-equivalent packages.
You should install mysql-devel for the MySQL development headers; you also need to have a development toolchain - the easiest way to install that is to issue sudo yum groupinstall "Development Tools".
Now, if you installed Python using yum as well, you need to install python-devel.