Django - MySQL在osx 10.9.5上不能使用python 3.4.3

时间:2015-11-13 08:11:19

标签: python django python-3.4 mysql-python

我正在构建一个需要使用mySql数据库的Web应用程序。我在mysql workbench中创建了一个数据库。当我尝试运行django命令时:

'python manager.py runserver'

我收到以下错误:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'

当我尝试通过'pip install mysql-python'安装MySQLdb(for python 3.4.3)时出现以下错误:

Collecting mysql-python
  Using cached MySQL-python-1.2.5.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python/setup_posix.py", line 2, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'

 Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python

1 个答案:

答案 0 :(得分:3)

了解PyPI上的MySQL-python

  

目前支持MySQL-3.23到5.5和Python-2.4到2.7。未来版本将支持Python-3.0。支持PyPy。

如果你想坚持使用Python 3.x,你需要使用mysqlclient