Python pyinstaller编译的脚本因缺少模块而崩溃

Python pyinstaller编译的脚本因缺少模块而崩溃,python,pyinstaller,Python,Pyinstaller,我试着在我的Mac上编译一个Python程序,一切都很顺利。然后我转到ubuntu,甚至无法正确编译hello world: 我写了最简单的hello world: print("hello world") 然后尝试使用以下方法编译: pyinstaller --onefile hello.py 一切似乎都很好,直到我试着运行它: dist/hello 并得到了以下回溯: [2886] mod is NULL - structTraceback (most recent call last

我试着在我的Mac上编译一个Python程序,一切都很顺利。然后我转到ubuntu,甚至无法正确编译hello world: 我写了最简单的hello world:

print("hello world")
然后尝试使用以下方法编译:

pyinstaller --onefile hello.py
一切似乎都很好,直到我试着运行它:

dist/hello
并得到了以下回溯:

[2886] mod is NULL - structTraceback (most recent call last):
  File "/usr/lib/python3.6/struct.py", line 13, in <module>
    from _struct import *
ModuleNotFoundError: No module named '_struct'
[2886] mod is NULL - pyimod02_archiveTraceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/PyInstaller-3.4.dev0+g5f91905-py3.6.egg/PyInstaller/loader/pyimod02_archive.py", line 28, in <module>
    import struct
ModuleNotFoundError: No module named 'struct'
[2886] mod is NULL - pyimod03_importersTraceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/PyInstaller-3.4.dev0+g5f91905-py3.6.egg/PyInstaller/loader/pyimod03_importers.py", line 24, in <module>
    from pyimod02_archive import ArchiveReadError, ZlibArchiveReader
ModuleNotFoundError: No module named 'pyimod02_archive'
Traceback (most recent call last):
  File "PyInstaller-3.4.dev0+g5f91905-py3.6.egg/PyInstaller/loader/pyiboot01_bootstrap.py", line 15, in <module>
ModuleNotFoundError: No module named 'pyimod03_importers'
[2886] Failed to execute script pyiboot01_bootstrap
并尝试用

pyinstaller --onefile hello.spec
但是当我尝试运行exe文件时,得到了与以前完全相同的错误

我做错了什么?
我在Ubuntu 16.04.3上使用pyinstaller 3.4.dev0+g5f91905和Python3.6.2,我遇到了同样的问题。你找到解决办法了吗?
pyinstaller --onefile hello.spec