2016-10-22 8 views
0

Ich bin derzeit mit Mac OS X 10.12.Ich versuche, MySQLdb zu installieren, aber diese Fehler erhalten.Mit pip zu installieren MySQLdb Fehler unter Mac OS X 10.12

Wenn ich sudo läuft MySQLdb installieren pip, ist die Fehlermeldung:

Collecting MySQL-python 
Downloading MySQL-python-1.2.5.zip (108kB) 
100% |████████████████████████████████| 112kB 233kB/s 
Complete output from command python setup.py egg_info: 
Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
    File "/private/tmp/pip-build-m1bhp0l0/MySQL-python/setup.py", line 13, in <module> 
    from setup_posix import get_config 
    File "/private/tmp/pip-build-m1bhp0l0/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/tmp/pip-build-m1bhp0l0/MySQL-python/ 

und dann versuche ich MySQL-Python-1.2.4b4 herunterladen und benutzen, um setup.py.Then ich direkt laufen habe diesen Fehler:

Traceback (most recent call last): 
File "/Users/phil/Downloads/MySQL-python-1.2.4b4 2/setup.py", line 18, in <module> 
metadata, options = get_config() 
File "/Users/phil/Downloads/MySQL-python-1.2.4b4 2/setup_posix.py", line 32, in get_config 
metadata, options = get_metadata_and_options() 
File "/Users/phil/Downloads/MySQL-python-1.2.4b4 2/setup_common.py", line 12, in get_metadata_and_options 
metadata = dict(config.items('metadata')) 
    File"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py", line 642, in items 
raise NoSectionError(section) 
ConfigParser.NoSectionError: No section: 'metadata' 

Ich habe viele Lösungen ausprobiert. Trotzdem hat es viele Fehler. Plz helfen hier.

Antwort

1

Das Problem ist das MySQL-Python-Paket nicht currently support Python 3.

Sie eine andere MySQL-Paket wie mysqlclient verwenden könnte, die ein Fork von MySQL-Python ist, unterstützt Python 3 und hat gut für mich gearbeitet:

sudo pip install mysqlclient 

Oder wenn Sie noch MySQL-Python verwenden, müssen Sie könnte versuche es in Python 2.7 zu installieren und benutze das für die Entwicklung:

Hoffe das hilft.

+0

Wie überprüfe ich, dass ich unter python3 oder 2 ...... ich denke, ich habe beide installiert .... – honesty1997

+0

Auch ich mysqlclient erfolgreich installieren.aber nicht ganz wissen, was der nächste Schritt ..... – honesty1997

+0

@ honesty1997 http://stackoverflow.com/documentation/django/4933/database-setup/17418/mysql-mariadb#t=201610220756400626975 – FeedTheWeb

Verwandte Themen