简体   繁体   English

PyInstaller找不到win32 API

[英]PyInstaller cannot find win32 API

I am trying to run pyinstaller , but I keep getting this: 我正在尝试运行pyinstaller ,但我一直这样:

Error: PyInstaller for Python 2.6+ on Windows needs pywin32.
Please install from http://sourceforge.net/projects/pywin32/

I have verified the existence of pywin32 . 我已经验证了pywin32的存在。 I have also attempted to write the full path to python.exe to verify I was running the correct Python executable. 我还尝试编写python.exe的完整路径来验证我是否正在运行正确的Python可执行文件。 What's wrong? 怎么了?

Wanted to add to the above information with my lessons learned from my experience. 希望从我的经验中吸取教训,增加上述信息。 First here is a link to a safe download of the latest pywin32. 首先是安全下载最新pywin32的链接 Some other links couldn't get through our firewalls. 其他一些链接无法通过我们的防火墙。

Error: PyInstaller for Python 2.6+ on Windows needs pywin32.
Please install from http://sourceforge.net/projects/pywin32/

The above error occurs when pywin32 has not been installed or has been installed incorrectly. 如果未安装pywin32或安装不正确,则会出现上述错误。 It also occurs when the wrong version of pywin32 has been installed. 当安装了错误版本的pywin32时也会发生这种情况。 If you do not get a final Finish dialog and button during the installation, it probably did not install correctly. 如果在安装过程中没有获得最终的Finish对话框和按钮,则可能无法正确安装。 Also you can use pip to create a new environment and in that environment command window, type: 您还可以使用pip创建新环境,并在该环境命令窗口中键入:

python -c "import win32api"

If you don't get any errors, the installation was performed correctly. 如果您没有收到任何错误,则表明安装正确。 The next thing to try in that same pip window and after you have installed PyInstaller is: 接下来要在同一个pip窗口中尝试并安装PyInstaller之后:

pyinstaller --version

Again if you get the error above, then you probably need a different version. 再次如果你得到上面的错误,那么你可能需要一个不同的版本。 Hope this helps someone out there as I spent hours trying to figure out why PyInstaller didn't work and kept getting the error above. 希望这可以帮助那些人,因为我花了几个小时试图找出为什么PyInstaller不工作并且不断得到上面的错误。 There is no indication from the pywin32 installation that the installation failed. pywin32安装没有指示安装失败。

Download appropriate version for your system and python verison from here 此处下载适用于您的系统和python verison的相应版本

Then try install manually or by: 然后尝试手动安装或通过:

easy_install "path\to\file\pywin32-218.win-amd64-py3.4.exe"

Can you import pywin32? 你能导入pywin32吗?

Make sure doesn't pywin32 installation cast any errors sometimes its easy to overlook. 确保没有pywin32安装投出任何错误有时很容易被忽视。

Also if this will not help: did you run Configure.py in pyinstaller? 此外,如果这没有帮助:你在pyinstaller中运行Configure.py?

Also sometimes instead of run(Windows is some kind of weirdo): 有时也不是运行(Windows是某种怪人):

Configure.py 

try: 尝试:

python Configure.py 

I hope it was helpful 我希望它有所帮助

I found out the answer! 我找到了答案! I just ended up installing CPython 2.7 over ActivePython. 我刚刚在ActivePython上安装了CPython 2.7。 And, guess what? 你猜怎么着? IT WORKED! 有效! Blame ActivePython. 责备ActivePython。

EDIT: Turns out it was more. 编辑:事实证明它更多。 I had installed 32-bit ActivePython on top of 64-bit CPython. 我在64位CPython之上安装了32位ActivePython。 Whoops. 哎呦。

This is appeared on pywin32-win64 doesn't support on latest of pyinstaller. 这个出现在pywin32-win64上不支持最新的pyinstaller。 I've fix it by installing pywin32-win32 on my current state of windows 7 64-bit. 我通过在我目前的Windows 7 64位状态下安装pywin32-win32来解决这个问题。 Please ensure to modify everything version number to based on your current python version number under registry PATH "HKLM\\SOFTWARE\\Python\\PythonCore", example like 3.3 to 2.7. 请确保根据您在注册表PATH“HKLM \\ SOFTWARE \\ Python \\ PythonCore”下的当前python版本号修改所有版本号,例如3.3到2.7。

Try install the 32-bit version rather than 64-bit. 尝试安装32位版本而不是64位版本。 It works for me. 这个对我有用。

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

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