错误' openssl/crypto.h'使用PIP在Mac上安装Pycurl时找不到文件
在MacOS x 10 10.15使用pip install -r unigess.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/[email protected]/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]
时目录。
添加了加密== 37.0.4
src/pycurl.h:178:13: fatal error: 'openssl/ssl.h' file not found
我首先 :
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
但也没有成功。 有什么帮助吗?
When installing Python3 packages on macOS X 10.15 Catalina using pip install -r requirements.txt
I am getting this error:
× 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/[email protected]/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]
So It fails on installing PycURL because it cannot find the openssl
include directory.
I have first added cryptography==37.0.4
to the requirements.txt
file but then I got:
src/pycurl.h:178:13: fatal error: 'openssl/ssl.h' file not found
Then I have tried installing latest openssl
with:
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
But it didn't help.
I also tried:
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
But also with no success.
Any help on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先安装openssl
然后
例外消失
first install openssl
then
the exception go away
最终有所帮助的是:
sumirns.txt
fileopenssl
with:brew brew install op openssl
openssl
以这样的目录安装:What eventually helped was:
pycurl
from therequirements.txt
fileopenssl
with:brew install openssl
openssl
installation directory withopenssl
install directories like this:使用
brew -prefix openssl
动态查找LDFLAGS,CPPFLAGS和PKG_CONFIG_PATH的路径:Using
brew --prefix openssl
to dynamically lookup the paths for LDFLAGS, CPPFLAGS, and PKG_CONFIG_PATH: