将Pyinstaller与pwlf一起使用会产生错误

时间:2020-06-26 14:29:01

标签: python python-3.x

我正在尝试使用文件结构为的python项目制作可执行文件:

Project
|
|-Folder1
|   |- __init__.py
|   |- other.py
|
|-Folder2
|   |- __init__.py
|   |- other2.py
|
|-__init__.py
|-main.py

运行使用此命令生成的可执行文件时:
pyinstaller main.py ,无论是否独立(using --onefile),我都会收到此回溯:

Traceback (most recent call last):
  File "Project\helper_script.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\users\l\appdata\local\programs\python\python36-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "Project\Tensile\tensile_gui.py", line 26, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\users\l\appdata\local\programs\python\python36-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "Project\utils\image_ret.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\users\l\appdata\local\programs\python\python36-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "Project\utils\helper.py", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\users\l\appdata\local\programs\python\python36-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pwlf\__init__.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\users\l\appdata\local\programs\python\python36-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pwlf\version.py", line 7, in <module>
  File "site-packages\importlib_metadata\__init__.py", line 576, in version
  File "site-packages\importlib_metadata\__init__.py", line 549, in distribution
  File "site-packages\importlib_metadata\__init__.py", line 206, in from_name
importlib_metadata.PackageNotFoundError: pwlf

我尝试使用--hidden-import pwlf选项,并确保已经安装了pwlf
到底是怎么回事?如何解决这个问题?
我在Windows上使用的是python 3.6.8(32位)

0 个答案:

没有答案