没有名为 psycopg2 的模块
我有使用 postgresql 9 的 Django 项目。我安装了 psycopg2,当我运行项目时,我收到“加载 psycopg2 模块时出错:dll 加载失败”。我第一次遇到这个问题。我有 Windows 7 x64 和 python2.7。我该如何解决这个问题?
I have Django project which uses postgresql 9. I installed psycopg2 and when I run project I receive 'Error loading psycopg2 module: dll load failed'. I met this issue for the first time. I have windows 7 x64 with python2.7. How can I solve this one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题,这是 psycopg2 无法使用 _easy_install_ 在 Windows 中很好地安装,我按照以下 SO 答案中的说明进行操作:
在 windows 上的 virtualenv 中安装 psycopg2 (postgresql)
您需要手动安装psycopg2 exe 文件:
psycopg2-2.4.2.win-amd64-py2.7-pg9.0.4-release.exe
I had the same problem, it was that psycopg2 does not install well in Windows with _easy_install_, I followed the instructions on the follow SO answer:
Installing psycopg2 (postgresql) in virtualenv on windows
You need to manually install the psycopg2 exe file:
psycopg2-2.4.2.win-amd64-py2.7-pg9.0.4-release.exe
我知道这会再次困扰我,或者正如 nwcell 所说:
我实际上有一台机器可以工作,并且我一直在努力设置另一台机器。我安装了Python 3.8,旧电脑安装的是3.7.4。主要区别在于文件:
C:\project\venv\Lib\site-packages\psycopg2_psycopg.cp37-win32.pyd
在新 PC 上,它显示为 AMD64。我最终卸载了 3.8 并恢复到 3.7.4,然后将文件从旧电脑复制到新电脑,然后遇到此错误:
https://stackoverflow.com/a/37819509/495455
转到 Stickpeople 的 WayBackMachine 版本:
https://web.archive .org/web/20191003103502/http://www.stickpeople.com/projects/python/win-psycopg/
我没有安装exe 中,我只是做了一个
pip install -Iv psycopg2-binary==2.8.4
此时它开始工作。所以我认为最新版本不起作用,对我来说 2.8.4 仍然有效: https: //pypi.org/project/psycopg2/#files这与 x64 有关,因为我在 AMD64 上尝试的所有方法都不起作用,而且我花了很长时间。
I know this is going to haunt me again or as nwcell puts it:
I actually have a machine with it working and I've been at pains to setup another machine. I installed Python 3.8 and the old PC has 3.7.4. The main difference was the file:
C:\project\venv\Lib\site-packages\psycopg2_psycopg.cp37-win32.pyd
On the new PC it was showing as AMD64. I eventually uninstalled 3.8 and reverted back to 3.7.4, then I copied the files from the old PC to the new and then I hit this error:
https://stackoverflow.com/a/37819509/495455
Going to a WayBackMachine version of the stickpeople:
https://web.archive.org/web/20191003103502/http://www.stickpeople.com/projects/python/win-psycopg/
I didn't install the exe, I simply did a
pip install -Iv psycopg2-binary==2.8.4
at which point it started working. So I'm thinking the latest version doesn't work, for me 2.8.4 still works: https://pypi.org/project/psycopg2/#filesIt's something to do with x64 as everything I tried with AMD64 didn't work and I spent ages on it.