导入pycurl时出现错误:库未加载:@rpath/libcrypto.1.1.dylib :原因:找不到图像。

3
我的Flask应用Python代码出错了,错误如下:
Traceback (most recent call last):
  File "######.py",
    import pycurl
ImportError: dlopen(/Users/########/Library/Python/3.7/lib/python/site-packages/pycurl.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libcrypto.1.1.dylib
  Referenced from: /Users/########/Library/Python/3.7/lib/python/site-packages/pycurl.cpython-37m-darwin.so
  Reason: image not found

操作系统:Darwin内核版本18.6.0 - Mojave 10.14.5

尝试更新brew, openssl(链接和取消链接,导出LDFLAGS,导出CFFFLAGS),但似乎都不起作用。

$ brew install openssl 
openssl 1.0.2s is already installed and up-to-date
$brew install curl-openssl
curl-openssl 7.65.3 is already installed and up-to-date

有什么其他的指点吗?提前感谢。

1个回答

0
在我的情况下解决问题的方法是更改Python查找这些库的路径,因为它们是通过brew安装的。但你可以告诉它在其他地方查找库:
在你的个人文件底部添加以下内容(~/.bashrc或~/.zshrc,取决于你的shell):
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/local/lib

然后重启您的 shell,并再次尝试(如果您正在使用 venv,请记得重新加载它)。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接