Psycopg2 image not found

后端 未结 20 1666
无人及你
无人及你 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:44

    In your bash environment before you load it, try this:

    export DYLD_LIBRARY_PATH=/Library/PostgreSQL/x.y/lib
    

    ..replacing the 'x.y' with the version on your system.

    ..be aware that setting this in your bash profile can interfere with other programs, as KindOfGuy noted.

    ..of course, if you're not running it from a bash prompt, you'll have to set up your environment in whatever way pyenv lets you. ..you could even edit pyenv itself and place that at the top.

    Another alternative is to put this in a python script which runs before you attempt to import psycopg2:

    import os
    os.environ['DYLD_LIBRARY_PATH'] = '/Library/PostgreSQL/x.y/lib'
    

    ..again, replacing 'x.y' with the version on your system in /Library/PostgreSQL.

提交回复
热议问题