执行文件FileNotFoundError时出现PyInstaller错误

时间:2020-01-17 13:42:29

标签: python pyinstaller executable

我正在尝试使用pyinstaller创建可执行的python文件,我的项目目录如下:

root:
  -images/
  -model/
  -detector/
  -main.py
  -model.py

我使用以下命令创建可执行文件:

pyinstaller --onefile -windowed --add-data="detector:." --add-data="images:." --add-data="models:." main.py

当我尝试运行它时,出现以下错误:

/var/folders/zz/sm754y2136gg7q3ps1n6nyyr0000gn/T/_MEIcwSOAH/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
/var/folders/zz/sm754y2136gg7q3ps1n6nyyr0000gn/T/_MEIcwSOAH/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
/var/folders/zz/sm754y2136gg7q3ps1n6nyyr0000gn/T/_MEIcwSOAH/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
/var/folders/zz/sm754y2136gg7q3ps1n6nyyr0000gn/T/_MEIcwSOAH/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
/var/folders/zz/sm754y2136gg7q3ps1n6nyyr0000gn/T/_MEIcwSOAH/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
/var/folders/zz/sm754y2136gg7q3ps1n6nyyr0000gn/T/_MEIcwSOAH/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
Traceback (most recent call last):
  File "main.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "model.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "tensorflow/__init__.py", line 28, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "tensorflow/python/__init__.py", line 73, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "tensorflow/python/ops/standard_ops.py", line 25, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "tensorflow/python/autograph/__init__.py", line 37, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "tensorflow/python/autograph/core/converter.py", line 71, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "tensorflow/python/autograph/pyct/cfg.py", line 41, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "tensorflow/python/autograph/pyct/compiler.py", line 32, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "/Users/luis/virtualenvironment/executable/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "astor/__init__.py", line 24, in <module>
**FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/zz/sm754y2136gg7q3ps1n6nyyr0000gn/T/_MEIcwSOAH/astor/VERSION'**
[12100] Failed to execute script main
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

有人知道发生了什么吗?我该如何解决?我没有在Google上找到任何类似的东西。

谢谢!

0 个答案:

没有答案