将 Mac 从 High Sierra 升级到 Catalina 打破了“import pycurl”

use*_*030 3 python ssl

我将我的 Mac 从 High Sierra 升级到 Catalina,但它坏了import pycurl。请参阅下面的错误。

我尝试了用户在这篇Stack Overflow 帖子中声称成功的所有选项,但无济于事。

ImportError: pycurl: libcurl link-time ssl backend (none/other) is different from compile-time ssl backend (openssl)
Run Code Online (Sandbox Code Playgroud)

我的 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
Run Code Online (Sandbox Code Playgroud)

我尝试了上面的所有命令组合:

% 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 
Run Code Online (Sandbox Code Playgroud)

等等。

我用过easy_install。

但它只是在卡塔利娜坏了!!有人解决了吗?

小智 5

以下对我有用,虽然它看起来有点hacky ..也许继续这样做,直到出现更好的解决方案?

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
Run Code Online (Sandbox Code Playgroud)

macOS 10.15 Python 3.7.4 pycurl 7.43.0.3 OpenSSL 1.0.2t