简体   繁体   English

Pyinstaller:导入错误:DLL 加载失败:找不到指定的模块

[英]Pyinstaller: Import Error: DLL load failed: The specified module could not be found

I'm trying create an executable from my code that uses PyQt5.我正在尝试从使用 PyQt5 的代码创建一个可执行文件。 I'm using Python 3.5.3 -64 bits, developing in Windows 10, and used pip to install pyinstaller 3.2.1.我正在使用 Python 3.5.3 -64 位,在 Windows 10 中开发,并使用 pip 安装 pyinstaller 3.2.1。

I run pyinstaller as such:我这样运行 pyinstaller:

pyinstaller.exe --onefile --windowed main.py

I get an Import Error:我收到导入错误:

File "C:\Python35\Scripts\pyinstaller-script.py", line 11, in <module> load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point
return ep.load()
File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
return self.resolve()
File "C:\Python35\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Python35\lib\site-packages\PyInstaller\__main__.py", line 21, in <module>
import PyInstaller.building.build_main
File "C:\Python35\lib\site-packages\PyInstaller\building\build_main.py", line 32, in <module>
from ..depend import bindepend
File "C:\Python35\lib\site-packages\PyInstaller\depend\bindepend.py", line 38, in <module>
from ..utils.win32.winmanifest import RT_MANIFEST
File "C:\Python35\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 97, in <module>
from PyInstaller.utils.win32 import winresource
File "C:\Python35\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 20, in <module>
import pywintypes
File "C:\Python35\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Python35\lib\site-packages\win32\lib\pywintypes.py", line 64, in __import_pywin32_system_module__
import _win32sysloader
ImportError: DLL load failed: The specified module could not be found.

I've read that this meanings pywin32 was not installed by pip and that I need to install this Microsoft Visual Package: https://www.microsoft.com/en-us/download/details.aspx?id=5555 .我读过这意味着 pywin32 不是由 pip 安装的,我需要安装这个 Microsoft Visual Package: https : //www.microsoft.com/en-us/download/details.aspx?id=5555 I downloaded and installed it but I'm getting the same error.我下载并安装了它,但我遇到了同样的错误。

Edit:编辑:

After installing pywin32 from sourceforge.net/projects/pywin32/files/pywin32/Build%20221, the import error is gone but I'm getting warnings when it's running (the output is hundreds of lines long, here is a snippet):从 sourceforge.net/projects/pywin32/files/pywin32/Build%20221 安装 pywin32 后,导入错误消失了,但我在运行时收到警告(输出长达数百行,这里是一个片段):

pyinstaller main.py

.... ....

3220 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of C:\Python35\python.exe

3251 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of C:\Python35\python.exe

3267 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of C:\Python35\python.exe

3305 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35\python.exe

3336 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of C:\Python35\python.exe

.... ....

9265 WARNING: lib not found: Qt5Core.dll dependency of C:\Python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll

9297 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of C:\Python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll

9333 WARNING: lib not found: Qt5Gui.dll dependency of C:\Python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll

9366 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of C:\Python35\lib\site-packages\PyQt5\Qt\plugins\imageformats\qgif.dll

Then I run:然后我运行:

pyinstaller main.spec

and get similar warnings.并得到类似的警告。 The resulting exe file closes immediately.生成的 exe 文件立即关闭。

you need to install pyinstaller and pywin32, which is same bit version as your python bit version is.您需要安装 pyinstaller 和 pywin32,它们的位版本与您的 python 位版本相同。

Get it from here: https://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/从这里获取: https : //sourceforge.net/projects/pywin32/files/pywin32/Build%20214/

choose amd64 ones if your python is 64-bit else non-amd64 ones如果您的 python 是 64 位,请选择 amd64 的,否则选择非 amd64 的

If you face any registry problems (or) Python installation directory not found issues, I can help如果您遇到任何注册表问题(或)未找到 Python 安装目录的问题,我可以提供帮助

暂无
暂无

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

相关问题 导入错误:DLL 加载失败。 指定的模块无法找到 - Import Error: DLL load failed. The specified module could not be found “import torch”给出错误“from torch._C import *, DLL load failed: The specified module could not be found” - "import torch" giving error "from torch._C import *, DLL load failed: The specified module could not be found" ver.2 PyGreSQL ERROR: from _pg import * ImportError: DLL load failed: The specified module could not be found - ver.2 PyGreSQL ERROR: from _pg import * ImportError: DLL load failed: The specified module could not be found 尝试导入 sklearn 模块时出错:ImportError:DLL 加载失败:找不到指定的模块 - Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found 导入错误:DLL加载失败:使用cxfreeze时找不到指定的模块 - Import Error: DLL load failed: The specified module could not be found when using cxfreeze cx_Freeze导入错误:DLL加载失败:找不到指定的模块 - cx_Freeze Import Error: DLL load failed: The specified module could not be found Tkinter给出导入错误:DLL加载失败:找不到指定的模块 - Tkinter giving Import Error: DLL load failed: The specified module could not be found 无法导入 tflite-support 包。 接收错误“DLL 加载失败:找不到指定的模块” - Unable to Import tflite-support package. Receiving error "DLL load failed: The specified module could not be found" 导入tensorflow错误:DLL加载失败:找不到指定的程序 - Import tensorflow error: DLL load failed: The specified procedure could not be found Tensorflow 错误:ImportError: DLL 加载失败:找不到指定的模块 - Tensorflow Error: ImportError: DLL load failed: The specified module could not be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM