问题: pip安装mysql-python会引发以下错误:
a)由于openSSL导致的错误(在评论下面解决)
1 warning generated.
clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -arch x86_64 build/temp.macosx-10.12-x86_64-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.7.18_1/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.12-x86_64-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
b)第二个错误:(未解决)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/vp/vyzq_s9172xbbhh6mzth7grw0000gn/T/pip-build-y6KQBa/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 53, in get_config
libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
File "setup_posix.py", line 8, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range
命令“python setup.py egg_info”失败,错误代码为1 /私营/无功/文件夹/ VP / vyzq_s9172xbbhh6mzth7grw0000gn / T / PIP-集结y6KQBa / MySQL的 - 蟒蛇/ 我在使用什么我使用的是MAC OS,我使用自制软件安装了mysql。然后我创建了一个虚拟环境&amp;运行pip安装
MySQL-python
配置如下:
HOMEBREW_VERSION: 1.2.0 (latest)
PYTHON_VERSION: 2.7.13 (latest)
PIP_VERSION: 9.0.1 (latest)
到目前为止我做了什么: 我已经采取了以下补救措施:
brew doctor
没有错误终端:
brew uninstall mysql
pip install MySQL-python
brew install mysql
mysql-connector-c
答案 0 :(得分:0)
最后,我通过卸载和解决了这个问题。重新安装X-Code
答案 1 :(得分:0)
这是因为您没有安装xcode或xcode工具。拥有xcode后,您可以使用以下命令安装xcode工具
xcode-select --install