简体   繁体   English

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

[英]Python official installer missing python27.dll

I installed Python 2.7 32-bit on Windows from official website and it is missing python27.dll.我从官方网站在 Windows 上安装了 Python 2.7 32 位,但缺少 python27.dll。 How can I get this DLL?我怎样才能得到这个 DLL?

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.其中 NN 是版本号。 On a 64-bit, a 32 bit dll will be installed here:在 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 与安装中的其余文件一起打包。

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.为了解决这个问题,我使用 msi 包安装 Python,并将 dll 复制到与 python.exe 相同的目录中。 I then commit the python folder to source control for our teams to use.然后我将 python 文件夹提交给我们的团队使用的源代码管理。 Finally, I uninstall Python from my local machine to ensure a clean environment.最后,我从我的本地机器上卸载 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 年里,我没有注意到这样做的问题,但很想了解更多关于使用这种方法的注意事项。

Download python 27 dll from here and place it in your /Windows folder. 这里下载python 27 dll并将其放在/ Windows文件夹中。 You would also need to update the environment variable adding the path of Python's installation. 您还需要更新环境变量,添加Python安装的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM