Psycopg2 image not found

后端 未结 20 1541
无人及你
无人及你 2020-11-29 18:04

Trying to setup postgres with the postgres mac app and hit this error, which I haven\'t been able to solve. Any thoughts?

    ImportError: dlopen(/Users/Crai         


        
相关标签:
20条回答
  • 2020-11-29 18:30

    try finding the file or files libssl.1.0.0.dylib and copy them to your '/usr/local/lib/' for me the origin was, '/Library/PostgreSQL/11/lib/' ,(change the version to yours) alternatively you may copy all to '/usr/local/lib/' go to the origin and type: sudo cp * /usr/local/lib/ to copy all files. I found the solution and changed it to solve mine https://oscarvalles.wordpress.com/2017/03/24/dlopenlibrary-not-loaded-libssl-dylib-fail-to-import-psycopg2-in-virtualenv/

    0 讨论(0)
  • I'm experiencing a similar issue with mysql. The library requested is is failing to load /usr/local/mysql/lib/libmysqlclient_r.16.dylib

    However, in this directory, there is a later version of the library: /usr/local/mysql/lib/libmysqlclient.20.dylib

    I am working in a virtualenvwrapper and have attempted to reinstall all of the previously install dependencies to no avail. Any assistance would be greatly appreciated.

    0 讨论(0)
  • 2020-11-29 18:32

    Try updating psycopg2 using pip install psycopg2 --upgrade to the latest version, then try again.

    0 讨论(0)
  • 2020-11-29 18:33

    I found a solution that worked for me when dealing with a similar issue on rails. Add the following to your .bash_profile, .bash_rc, or equivalent:

    export DYLD_FALLBACK_LIBRARY_PATH=/Applications/Postgres.app/Contents/MacOS/lib:$DYLD_LIBRARY_PATH
    

    (Assuming you installed Postgres.app in the default location). Then restart your terminal session and try again.

    Exporting to DYLD_LIBRARY_PATH directly can cause serious problems with other apps that depend on it, but using the fallback path avoids these problems.

    See also: https://github.com/PostgresApp/PostgresApp/issues/109#issuecomment-18387546

    EDIT: It seems that setting DYLD_FALLBACK_LIBRARY_PATH causes an error when you try to run psql. To fix this, you can add the following two lines to your .bash_profile:

    alias psql="(. ~/.bash_profile; unset DYLD_FALLBACK_LIBRARY_PATH; psql)";
    

    This is assuming that you're using bash and that your .bash_profile is located in your home directory. If that's not the case (or if you're using a .bashrc or other environment setup instead of .bash_profile) change the ~/.bash_profile part of the command to the path to your environment setup script.

    The aliased command basically starts a subshell which does not effect your current bash environment. So when it unsets the DYLD_FALLBACK_LIBRARY_PATH variable, it's only temporary. After you exit psql the environment variable will be set again.

    0 讨论(0)
  • 2020-11-29 18:33

    Did you install psycopg2? You need it in order to integrate python with postgresql.

    0 讨论(0)
  • 2020-11-29 18:36

    Use psycopg2-binary instead

    pip install psycopg2-binary
    
    0 讨论(0)
提交回复
热议问题