![將 Mac 從 High Sierra 升級到 Catalina 破壞了“導入 pycurl”](https://rvso.com/image/1606685/%E5%B0%87%20Mac%20%E5%BE%9E%20High%20Sierra%20%E5%8D%87%E7%B4%9A%E5%88%B0%20Catalina%20%E7%A0%B4%E5%A3%9E%E4%BA%86%E2%80%9C%E5%B0%8E%E5%85%A5%20pycurl%E2%80%9D.png)
我將我的 Mac 從 High Sierra 升級到 Catalina,但它壞了import pycurl
。請參閱下面的錯誤。
我嘗試了用戶聲稱在此成功的所有選項堆疊溢位帖子但沒有用。
ImportError: pycurl: libcurl link-time ssl backend (none/other) is different from compile-time ssl backend (openssl)
我的 pycurl 版本是7.43.0.3
Python版本是3.6.4。
[我也用Catalina的1.0.2t嘗試過,然後libressl
在下面嘗試了]
% openssl version -a
LibreSSL 2.8.3
built on: date not available
platform: information not available
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx)
compiler: information not available
OPENSSLDIR: "/private/etc/ssl"
% echo $PYCURL_SSL_LIBRARY
openssl
% echo $LDFLAGS
-L/usr/local/opt/openssl/lib
% echo $CPPFLAGS
-I/usr/local/opt/openssl/include
我嘗試了上面的所有命令組合:
% pip install --global-option="--with-openssl" --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include --compile --no-cache-dir" pycurl
% brew uninstall openssl
ETC。
我用的是easy_install。
但它剛剛被打破卡塔莉娜!!有人解決這個問題了嗎?
答案1
以下對我有用,雖然看起來有點老套..也許繼續這樣做,直到出現更好的解決方案?
brew install curl-openssl
export PYCURL_SSL_LIBRARY=openssl
export PYCURL_CURL_CONFIG=/usr/local/opt/curl-openssl/bin/curl-config
export LDFLAGS='-L/usr/local/opt/openssl/lib -L/usr/local/opt/c-ares/lib -L/usr/local/opt/nghttp2/lib -L/usr/local/opt/libmetalink/lib -L/usr/local/opt/rtmpdump/lib -L/usr/local/opt/libssh2/lib -L/usr/local/opt/openldap/lib -L/usr/local/opt/brotli/lib'
export CPPFLAGS=-I/usr/local/opt/openssl/include
pip install pycurl --compile --no-cache-dir
macOS 10.15 Python 3.7.4 pycurl 7.43.0.3 OpenSSL 1.0.2t
答案2
這對我有用
pip uninstall pycurl
pip install --compile --install-option="--with-openssl" pycurl
答案3
我在 MacBook Pro 上運行 MacOS ventura。我們使用 Ptyhon 3.7。以下對我有用:
% python3.7 -m pip uninstall pycurl
% brew install curl
% brew install openssl
% export LDFLAGS="-L/usr/local/opt/curl/lib $LDFLAGS"
% export CPPFLAGS="-I/usr/local/opt/curl/include $CPPFLAGS"
% export PKG_CONFIG_PATH=/usr/local/opt/curl/lib/pkgconfig
% python3.7 -m pip install pycurl==7.45.2 --no-cache-dir --compile --ignore-installed --install-option="--openssl-dir=/usr/local/opt/openssl@3/"