gpt4 book ai didi

python - mysql-python的pip安装抛出clang错误

转载 作者:行者123 更新时间:2023-11-30 21:59:18 24 4
gpt4 key购买 nike

问题:mysql-python 的 pip 安装抛出以下错误:

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

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/vp/vyzq_s9172xbbhh6mzth7grw0000gn/T/pip-build-y6KQBa/MySQL-python/ What I am using I am using a MAC OS and I have installed mysql using homebrew. Then I created a virtual environment & ran pip install MySQL-python

配置是:

HOMEBREW_VERSION: 1.2.0 (latest)
PYTHON_VERSION: 2.7.13 (latest)
PIP_VERSION: 9.0.1 (latest)

到目前为止我做了什么:我已经绑定(bind)了以下补救措施,例如:

  1. 确保brew doctor没有错误
  2. 重新安装 X 代码设置工具
  3. 卸载和安装 mysql

终端:

brew uninstall mysql
pip install MySQL-python
brew install mysql
  1. 尝试不同版本的 mysql-python (1.2.3, 1.2.4 & 1.2.5)
  2. 尝试使用 mysql-connector-c
  3. 正如下面评论中所建议的,解决 brew link openssl 解决了第一个错误。但是我没能解决第二个问题

最佳答案

最后我通过卸载并重新安装 X-Code 解决了这个问题

关于python - mysql-python的pip安装抛出clang错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43951091/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com