简体   繁体   中英

cannot install MySQL-python on os x

I'm trying to use MySQL database with Django on OS X 10.11.3 but when i try "pip install MySQL-python" it gives me this error:

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 1, in <module>
      File "/private/var/folders/0q/24f40xt52fg_xbjz5drz_m2r0000gn/T/pip-build-8ms1ni7b/MySQL-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/private/var/folders/0q/24f40xt52fg_xbjz5drz_m2r0000gn/T/pip-build-8ms1ni7b/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/0q/24f40xt52fg_xbjz5drz_m2r0000gn/T/pip-build-8ms1ni7b/MySQL-python

I tried installing ConfigParser and i have MySQL python connector installed on my system.

Here are my project details:

Django 1.9.2
Python 3.5
OS X 10.11.3
IDE PyCharm
Virtual Environment myvenv

I've searched internet and almost tried all methods to use MySQL with Django but i'm failing since hours. Please guide me with this

It looks like you're trying to install the Python 2.X only driver on Python 3. The documentation recommends using mysqlclient:

https://docs.djangoproject.com/en/1.9/ref/databases/#mysql-db-api-drivers

The mysqlclient GitHub page with install instructions, including pre-requisites you may need:

https://github.com/PyMySQL/mysqlclient-python

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM