在macOS X 10.15 Catalina 上使用pip install -r requirements.txt
安装Python3软件包时,我收到以下错误:
× Running setup.py install for pycurl did not run successfully.
│ exit code: 1
╰─> [25 lines of output]
/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-install-8r44qz4e/pycurl_09ab3d56141443439eb3f41fa62f7b0f/setup.py:771: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(distutils.__version__) > LooseVersion("1.0.1"):
/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-install-8r44qz4e/pycurl_09ab3d56141443439eb3f41fa62f7b0f/setup.py:773: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(distutils.__version__) < LooseVersion("1.0.3"):
Using curl-config (libcurl 7.84.0)
running install
/usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-cpython-39
creating build/lib.macosx-10.15-x86_64-cpython-39/curl
copying python/curl/__init__.py -> build/lib.macosx-10.15-x86_64-cpython-39/curl
running build_ext
building 'pycurl' extension
creating build/temp.macosx-10.15-x86_64-cpython-39
creating build/temp.macosx-10.15-x86_64-cpython-39/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -DPYCURL_VERSION=\"7.43.0\" -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/usr/local/Cellar/curl/7.84.0/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/docstrings.c -o build/temp.macosx-10.15-x86_64-cpython-39/src/docstrings.o
In file included from src/docstrings.c:4:
src/pycurl.h:170:13: fatal error: 'openssl/crypto.h' file not found
# include <openssl/crypto.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
所以它安装PycURL失败,因为它找不到openssl
包含目录。
我首先将cryptography==37.0.4
添加到requirements.txt
文件中,然后得到:
src/pycurl.h:178:13: fatal error: 'openssl/ssl.h' file not found
然后我尝试安装最新的openssl
:
brew update
brew install openssl
brew link --force openssl
ln -s /usr/local/opt/openssl/lib/libcrypto.3.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.3.dylib /usr/local/lib/
ln -s /usr/local/Cellar/openssl/3.0.4/bin/openssl /usr/local/bin/openssl
但没有用。
我也试过:
export PYCURL_SSL_LIBRARY=openssl
export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
pip install --no-cache-dir --compile --ignore-installed --install-option="--with-openssl" pycurl
但也没有成功。有人帮忙吗?
2条答案
按热度按时间unftdfkk1#
最终帮助我们的是:
1.从
requirements.txt
文件中删除pycurl
1.安装
openssl
时使用:brew install openssl
1.查找
openssl
安装目录1.安装PycURL,指定内联上述
openssl
安装目录,如下所示:1.现在PycURL安装没有任何问题:
6bc51xsx2#
安装openssl
然后
异常消失