openssl - 在 MacOS 上安装 pycurl。 (链接时 ssl 后端(无/其他)与编译时 ssl 后端(openssl)不同)

标签 openssl macos-sierra pycurl

我正在尝试在 MacOS Sierra 上的 venv 中安装 pycurl。我已经清理干净,通过 brew 安装了 openssl,告诉 pip 链接到该 openssl 安装并尝试加载模块。它提示“无/其他”与“openssl”不同。

ImportError: pycurl: libcurl link-time ssl backend (none/other) is different from compile-time ssl backend (openssl)

似乎该包已按预期编译,但它试图加载错误的 ssl 库。关于解决这个问题有什么建议吗?我在谷歌搜索之后尝试了谷歌搜索。

完整安装尝试:
(venv) R5106464:venv m106093$ brew uninstall openssl
Error: No such keg: /usr/local/Cellar/openssl
(venv) R5106464:venv m106093$ pip uninstall pycurl
Skipping pycurl as it is not installed.
(venv) R5106464:venv m106093$ brew install openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2q.sierra.bottl
Already downloaded: /Users/m106093/Library/Caches/Homebrew/downloads/b6dec2b57ee88a3cb02335284971b3b1e902d8b43fef115b456a971e5d0981ce--openssl-1.0.2q.sierra.bottle.tar.gz
==> Pouring openssl-1.0.2q.sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2q: 1,794 files, 12.3MB
(venv) R5106464:venv m106093$ PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" pip install --no-cache-dir pycurl
Collecting pycurl
  Downloading https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz (214kB)
    100% |████████████████████████████████| 215kB 3.6MB/s 
Installing collected packages: pycurl
  Running setup.py install for pycurl ... done
Successfully installed pycurl-7.43.0.2
(venv) R5106464:venv m106093$ python
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycurl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: pycurl: libcurl link-time ssl backend (none/other) is different from compile-time ssl backend (openssl)
>>> 

最佳答案

你好,我在 Mac OS Mojave 中遇到了 python 3.8 的这个问题,我解决了:

sudo -H pip uninstall pycurl

brew install openssl

PYCURL_SSL_LIBRARY=openssl

pip install --no-cache-dir --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include" --user pycurl

现在正在工作 PycURL

关于openssl - 在 MacOS 上安装 pycurl。 (链接时 ssl 后端(无/其他)与编译时 ssl 后端(openssl)不同),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54175760/

相关文章:

RNetLogo 不适用于 macOS Sierra 和 Windows

freebsd - 修复容易出现 CVE-2018-16868 的 gnutls

java - openssl_加密 aes 256 与 java 中的哈希

mysql - 拒绝访问使用 SSL 的 MySQL 远程连接尝试

swift - OSX Sierra Nsspeechrecognizer 问题

python - Python上 “.perform()”的语法无效

Python:PyCurl 设置 URL 异常

c++ - 最快的 SHA1 实现是什么?

openssl - 从 .cer 和 .pem 文件创建 pfx 文件

Apache - 您无权访问/在此服务器上