ModuleNotFoundError: No module named ‘pefile‘
Posted Data+Science+Insight
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ModuleNotFoundError: No module named ‘pefile‘相关的知识,希望对你有一定的参考价值。
ModuleNotFoundError: No module named 'pefile'
目录
ModuleNotFoundError: No module named 'pefile'
问题:
使用pyinstaller打包程序为exe格式。
打包过程发生如下错误:
ModuleNotFoundError: No module named 'pefile'
解决:
方法一:如果这个包不需要那么直接跳过算了
pyinstaller --hidden-import pefile
例如:
pyinstaller --onefile -w --hidden-import PyQt5.QtNetwork .\\main.py
方法二:可能是缺少这个包
pip install pefile
方法三:可能是缺少这个包
那就是pyinstaller的版本和python的版本不匹配的问题,可能需要基于python版本安装特定的pyinstaller。
conda install -c conda-forge pyinstaller=3.2.1
pip install pyinstaller=version_number
完整错误:
F:\\test\\test>pyinstaller -F test.pyw
Traceback (most recent call last):
File "c:\\users\\user1\\anaconda3\\lib\\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\\users\\user1\\anaconda3\\lib\\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\\Users\\user1\\anaconda3\\Scripts\\pyinstaller.exe\\__main__.py", line 7, in <module>
File "c:\\users\\user1\\anaconda3\\lib\\site-packages\\PyInstaller\\__main__.py", line 107, in run
parser = generate_parser()
File "c:\\users\\user1\\anaconda3\\lib\\site-packages\\PyInstaller\\__main__.py", line 78, in generate_parser
import PyInstaller.building.build_main
File "c:\\users\\user1\\anaconda3\\lib\\site-packages\\PyInstaller\\building\\build_main.py", line 35, in <module>
from PyInstaller.depend import bindepend
File "c:\\users\\user1\\anaconda3\\lib\\site-packages\\PyInstaller\\depend\\bindepend.py", line 39, in <module>
import pefile
ModuleNotFoundError: No module named 'pefile'
F:\\test\\test>pyinstaller -F test.pyw
Traceback (most recent call last):
File "c:\\users\\user1\\anaconda3\\lib\\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\\users\\user1\\anaconda3\\lib\\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\\Users\\user1\\anaconda3\\Scripts\\pyinstaller.exe\\__main__.py", line 7, in <module>
File "c:\\users\\user1\\anaconda3\\lib\\site-packages\\PyInstaller\\__main__.py", line 107, in run
parser = generate_parser()
File "c:\\users\\user1\\anaconda3\\lib\\site-packages\\PyInstaller\\__main__.py", line 78, in generate_parser
import PyInstaller.building.build_main
File "c:\\users\\user1\\anaconda3\\lib\\site-packages\\PyInstaller\\building\\build_main.py", line 35, in <module>
from PyInstaller.depend import bindepend
File "c:\\users\\user1\\anaconda3\\lib\\site-packages\\PyInstaller\\depend\\bindepend.py", line 39, in <module>
import pefile
ModuleNotFoundError: No module named 'pefile'
参考:
python - pyinstaller ModuleNotFoundError: No module named 'PyQt5.QtNetwork' - Stack Overflow
参考:python - No module named when using PyInstaller - Stack Overflow
以上是关于ModuleNotFoundError: No module named ‘pefile‘的主要内容,如果未能解决你的问题,请参考以下文章
ModuleNotFoundError: No module named 'gdbm'
Python:ModuleNotFoundError: No module named 'windows'
PySpark 自定义 UDF ModuleNotFoundError: No module named
用Java调用.py程序出现ModuleNotFoundError: No module named 'java'
ModuleNotFoundError: No module named 'jupyter_contrib_nbextensions' .ipynb文件转换.py文件时遇到错误(示例
ModuleNotFoundError: No module named 'jupyter_contrib_nbextensions' .ipynb文件转换.py文件时遇到错误(示例