Ton*_*ony 7 macos openssl pip pycurl python-3.x
使用 macOS X 10.15 Catalina 安装 Python3 包时pip install -r requirements.txt出现此错误:
\xc3\x97 Running setup.py install for pycurl did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [25 lines of output]\n /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.\n if LooseVersion(distutils.__version__) > LooseVersion("1.0.1"):\n /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.\n if LooseVersion(distutils.__version__) < LooseVersion("1.0.3"):\n Using curl-config (libcurl 7.84.0)\n running install\n /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.\n warnings.warn(\n running build\n running build_py\n creating build\n creating build/lib.macosx-10.15-x86_64-cpython-39\n creating build/lib.macosx-10.15-x86_64-cpython-39/curl\n copying python/curl/__init__.py -> build/lib.macosx-10.15-x86_64-cpython-39/curl\n running build_ext\n building 'pycurl' extension\n creating build/temp.macosx-10.15-x86_64-cpython-39\n creating build/temp.macosx-10.15-x86_64-cpython-39/src\n 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\n In file included from src/docstrings.c:4:\n src/pycurl.h:170:13: fatal error: 'openssl/crypto.h' file not found\n # include <openssl/crypto.h>\n ^~~~~~~~~~~~~~~~~~\n 1 error generated.\n error: command '/usr/bin/clang' failed with exit code 1\n [end of output]\nRun Code Online (Sandbox Code Playgroud)\n所以安装 PycURL 失败,因为它找不到openssl包含目录。
我首先添加cryptography==37.0.4到requirements.txt文件中,但后来我得到:
src/pycurl.h:178:13: fatal error: 'openssl/ssl.h' file not found\nRun Code Online (Sandbox Code Playgroud)\n然后我尝试安装最新openssl版本:
brew update\nbrew install openssl\nbrew link --force openssl\nln -s /usr/local/opt/openssl/lib/libcrypto.3.dylib /usr/local/lib/\nln -s /usr/local/opt/openssl/lib/libssl.3.dylib /usr/local/lib/\nln -s /usr/local/Cellar/openssl/3.0.4/bin/openssl /usr/local/bin/openssl\nRun Code Online (Sandbox Code Playgroud)\n但这没有帮助。
\n我也尝试过:
\nexport PYCURL_SSL_LIBRARY=openssl\nexport LDFLAGS="-L/usr/local/opt/openssl@3/lib"\nexport CPPFLAGS="-I/usr/local/opt/openssl@3/include"\n\npip install --no-cache-dir --compile --ignore-installed --install-option="--with-openssl" pycurl\nRun Code Online (Sandbox Code Playgroud)\n但也没有成功。\n对此有什么帮助吗?
\nTon*_*ony 20
最终有帮助的是:
\npycurl从requirements.txt文件中删除openssl:brew install opensslopenssl安装目录$ brew --prefix openssl\n/usr/local/opt/openssl@3\n\n$ ls -la /usr/local/opt/openssl@3\nlrwxr-xr-x 1 runner admin 25 Jul 6 09:13 /usr/local/opt/openssl@3 -> ../Cellar/openssl@3/3.0.4\nRun Code Online (Sandbox Code Playgroud)\nopenssl安装目录,如下所示:PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/Cellar/openssl@3/3.0.4/lib" CPPFLAGS="-I/usr/local/Cellar/openssl@3/3.0.4/include" pip3 install --no-cache-dir pycurl\nRun Code Online (Sandbox Code Playgroud)\nCollecting pycurl\n Downloading pycurl-7.45.1.tar.gz (233 kB)\n \xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81 233.9/233.9 kB 64.5 MB/s eta 0:00:00\n Preparing metadata (setup.py): started\n Preparing metadata (setup.py): finished with status \'done\'\nBuilding wheels for collected packages: pycurl\n Building wheel for pycurl (setup.py): started\n Building wheel for pycurl (setup.py): finished with status \'done\'\n Created wheel for pycurl: filename=pycurl-7.45.1-cp39-cp39-macosx_10_15_x86_64.whl size=146607 sha256=aff9581cbd6ddec739c529df376ad2d4edf49dafdad179a9b68bddeb60a739b3\n Stored in directory: /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-ephem-wheel-cache-hjqadgim/wheels/4d/ef/77/ffab9dc4b0016ce4f780b752e0020815e416f0d27a701a816f\nSuccessfully built pycurl\nInstalling collected packages: pycurl\nSuccessfully installed pycurl-7.45.1\n\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
3277 次 |
| 最近记录: |