简体   繁体   中英

library not loaded: libssl.1.0.0.dylib reason: image not found

I am getting the following error (on osx):

Traceback (most recent call last):
  File "./permission_analysis.py", line 9, in <module>
    import psycopg2
  File "/Library/Python/2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib
  Referenced from: /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
  Reason: image not found

So this looks a lot like this question:

Psycopg2 image not found

Except that the most popular upvoted answer doesn't work:

$ sudo ln -s /Library/PostgreSQL/9.2/lib/libssl.1.0.0.dylib /usr/lib
$ sudo ln -s /Library/PostgreSQL/9.2/lib/libcrypto.1.0.0.dylib /usr/lib

If I try to do either of those commands, it says the file already exists.

I feel your pain with trying to get Psycopg2 to work on Mac. I tried for ages, but i got it working in the end.

I asked this question and answered it here

Thanks guys.

@maxymoo I went with your suggestion. I have installed anaconda2. The install updated my path to include /anaconda/bin.

Then using the navigator I installed pyscopg2. Now I am able to use this in the shebang and my scripts execute fine and i'm able to import this module.

Gurmokhs-MBP:rest Gurmokh$ python
Python 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:43:17) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import psycopg2
if psycopg2.connect("dbname='postgres' user='postgres' host='localhost'"):
...     print "connection made"
... 
connection made
>>> 

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