没有名为 psycopg2 的模块

发布于 2024-12-18 13:43:12 字数 142 浏览 3 评论 0原文

我有使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

给妤﹃绝世温柔 2024-12-25 13:43:12

我遇到了同样的问题,这是 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

再浓的妆也掩不了殇 2024-12-25 13:43:12

我知道这会再次困扰我,或者正如 nwcell 所说:

每次我需要在 Windows 上设置 psycopg2 时,我都会想拍摄一些东西。

我实际上有一台机器可以工作,并且我一直在努力设置另一台机器。我安装了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:

Every time I need to set up psycopg2 on windows, I wind up wanting to shoot something.

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/#files

It's something to do with x64 as everything I tried with AMD64 didn't work and I spent ages on it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文