简体   繁体   中英

import pycurl: Library not loaded: @rpath/libcrypto.1.1.dylib : Reason: image not found

My flask app python code error's out with below error :

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

OS: Darwin Kernel Version 18.6.0 - Mojave 10.14.5

Tried updating brew, openssl (link and unlink, export LDFLAGS, export CFFFLAGS) but nothing appears to work

$ 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

Any additional pointers to try. Thanks in advance

What solved it in my case was changing the path where Python would look for this libs, as they were installed by brew. But you can tell it to look for the lib somewhere else:

Add the following at the bottom of your profile file (~/.bashrc or ~/.zshrc, depending on your shell) :

export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/local/lib

Then restart your shell, and try again (remember to reload your venv if your were using one).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM