Python 官方安装程序缺少 python27.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24517754/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 04:43:42  来源:igfitidea点击:

Python official installer missing python27.dll

pythonwindowsdllinstallation

提问by denfromufa

I installed Python 2.7.7 32-bit on Windows from official website and it is missing python27.dll. How can I get this DLL?

我从官方网站在 Windows 上安装了 Python 2.7.7 32 位,但缺少 python27.dll。我怎样才能得到这个 DLL?

采纳答案by Juan

At least for the ActiveState Python distribution, and in the official Python distribution:

至少对于 ActiveState Python 发行版,以及在官方 Python 发行版中:

https://docs.python.org/2/faq/windows.html#id7

https://docs.python.org/2/faq/windows.html#id7

The dll is in

dll在

C:\Windows\System\PythonNN.dll

where NN is the version number. On a 64-bit, a 32 bit dll will be installed here:

其中 NN 是版本号。在 64 位上,将在此处安装 32 位 dll:

%SystemRoot%\SysWoW64

and a running 32 bit application will magically translate this to the proper path, http://en.wikipedia.org/wiki/WoW64

一个正在运行的 32 位应用程序会神奇地将其转换为正确的路径,http://en.wikipedia.org/wiki/WoW64

When I link againsy Python27, I use the lib file here:

当我再次链接 Python27 时,我在这里使用了 lib 文件:

C:\Python27\libs\python27.lib

It is somewhat disappointing that the dll gets put in system directories since it means that you can have only one 32 bit and one 64 bit distribution with the same version number.

将 dll 放在系统目录中有点令人失望,因为这意味着您只能拥有具有相同版本号的 32 位和 64 位发行版。

Update:

更新:

Note that if you use the Anaconda or Miniconda Python distributions from Continuum Analytics (http://continuum.io), they are much more portable in the sense they package the dll along with the rest of the files in the installation.

请注意,如果您使用来自 Continuum Analytics ( http://continuum.io)的 Anaconda 或 Miniconda Python 发行版,它们将更加便携,因为它们将 dll 与安装中的其余文件一起打包。

回答by planetboy

I deploy Python via source control so can't rely on

我通过源代码管理部署 Python,所以不能依赖

C:\Windows\System\PythonNN.dll

To resolve this, I install Python using the msi package and copy the dll into the same directory as the python.exe. I then commit the python folder to source control for our teams to use. Finally, I uninstall Python from my local machine to ensure a clean environment.

为了解决这个问题,我使用 msi 包安装 Python,并将 dll 复制到与 python.exe 相同的目录中。然后我将 python 文件夹提交给我们的团队使用的源代码管理。最后,我从我的本地机器上卸载 Python 以确保一个干净的环境。

I have not noticed an issue with doing this over the past 7 years but would love to learn more about any caveats using this approach.

在过去的 7 年里,我没有注意到这样做的问题,但很想了解更多关于使用这种方法的注意事项。