系统:MAC OS 10.13
Python 3.7
import MySQLdb <BR>
Traceback (most recent call last):<BR>
File "<stdin>", line 1, in <module><BR>
File <BR>"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module><BR>
import _mysql<BR>
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/_mysql.cpython-37m-darwin.so, 2): Symbol not found: _syslog$DARWIN_EXTSN<BR>
Referenced from: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
当我尝试这样做时:
pip install MySQL-python
输出:
Collecting MySQL-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/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/r3/l2jk9m3d3497b902lbnkzcz40000gn/T/pip-install-q5k3f7m1/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/var/folders/r3/l2jk9m3d3497b902lbnkzcz40000gn/T/pip-install-q5k3f7m1/MySQL-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r3/l2jk9m3d3497b902lbnkzcz40000gn/T/pip-install-q5k3f7m1/MySQL-python/
我在此错误中花费了3天 你能帮我吗,非常感谢
答案 0 :(得分:0)
看起来问题在于MySQLdb不支持python 3 Python 3 ImportError: No module named 'ConfigParser',这里有一个答案说尝试使用mysqlclient https://stackoverflow.com/a/23978968/5446449,因为它支持python3。希望对您有帮助