记录一次macos 安装MySQL-python报错
同事说自己安装MySQL-python报错误,结果我自己试了试也是一样,本次安装总共遇到两个错误:_mysql.c:44:10: fatal error: ‘my_config.h’ file not found 和 ld: library not found for -lssl。
1. my_config.h not found解决方案
现象:
pip2 install MySQL-python
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/, http://pypi.garenanow.com/
Collecting MySQL-python
Downloading https://mirrors.aliyun.com/pypi/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108 kB)
|████████████████████████████████| 108 kB 364 kB/s
Building wheels for collected packages: MySQL-python
Building wheel for MySQL-python (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7z/kp0xr4ws26n8qmfvjxdmdb4w0000gy/T/pip-install-x0BvsP/mysql-python/setup.py'"'"'; __file__='"'"'/private/var/folders/7z/kp0xr4ws26n8qmfvjxdmdb4w0000gy/T/pip-install-x0BvsP/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/7z/kp0xr4ws26n8qmfvjxdmdb4w0000gy/T/pip-wheel-P159gW
cwd: /private/var/folders/7z/kp0xr4ws26n8qmfvjxdmdb4w0000gy/T/pip-install-x0BvsP/mysql-python/
Complete output (30 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11.5-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-11.5-x86_64-2.7
creating build/lib.macosx-11.5-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-11.5-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-11.5-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-11.5-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-11.5-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-11.5-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-11.5-x86_64-2.7/MySQLdb
creating bui