Django error for psycopg2 ImportError: DLL load failed

删除回忆录丶 提交于 2019-12-14 03:45:39

问题


Hi I am getting this error while I am trying to run syncdb in my virtual environment.

If I copy psycopg2 folder to my project folder (where I have my manage.py and settings.py) then this error disappears. But I still get this error when the code is pushed to heroku.

I have referred to many online materials but wasn't very lucky.

File "c:\Users\mayayadav\anteus\venv\lib\site-packages\psycopg2-2.4.5-py2.7-wi
  n32.egg\psycopg2\__init__.py", line 67, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: The specified module could not be found. (venv)

回答1:


I had the same problem on Windows, The way i get it working was to install psycopg2 from:

http://www.stickpeople.com/projects/python/win-psycopg/

And doing it this way it's recomended here http://initd.org/psycopg/install/




回答2:


In the case, where the install binaries are not up to date (as it happened today: latest Python is 3.4 and PostgresSQL - 9.3, while latest avaiable are 3.3 and 9.2.6 respectively), it is enough to add the PostgresSQL binary path (e.g. C:\Program Files\PostgreSQL\9.3\bin) to the path variable.

Note: you need to restart your command line to get it working.




回答3:


2019 Update

I encountered the same issue with Python 3.8 and psycopg2 2.8.3 and 2.8.4. Apparently psycopg2 doesn't work with Python 3.8 yet (understandably, since 3.8 released very recently). The fix for me was to go back to using Python 3.7.



来源:https://stackoverflow.com/questions/12765800/django-error-for-psycopg2-importerror-dll-load-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!