安装时出现了一些错误,但是我仍然收到了“成功”消息:
$ sudo pip3 install pyinstaller
[sudo] password for user:
Downloading/unpacking pyinstaller
Downloading PyInstaller-3.0.tar.gz (2.7MB): 2.7MB downloaded
Running setup.py (path:/tmp/pip_build_root/pyinstaller/setup.py) egg_info for package pyinstaller
warning: no files found matching '*.txt' under directory 'doc'
warning: no previously-included files matching '*' found under directory 'bootloader/build'
warning: no previously-included files matching '*' found under directory 'bootloader/.waf*'
warning: no previously-included files matching '*' found under directory 'bootloader/waf3-*'
warning: no previously-included files found matching 'bootloader/.lock-waf*'
warning: no previously-included files matching '*' found under directory 'doc/source'
warning: no previously-included files found matching 'doc/source'
warning: no previously-included files matching '*' found under directory 'old'
warning: no previously-included files found matching 'old'
warning: no previously-included files matching '*' found under directory 'scripts'
warning: no previously-included files found matching 'scripts'
warning: no previously-included files matching '*' found under directory 'tests/scripts'
warning: no previously-included files found matching 'tests/scripts'
warning: no previously-included files found matching '.*'
warning: no previously-included files found matching '*.yml'
warning: no previously-included files matching '*.pyo' found anywhere in distribution
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python3/dist-packages (from pyinstaller)
Installing collected packages: pyinstaller
Running setup.py install for pyinstaller
warning: no files found matching '*.txt' under directory 'doc'
warning: no previously-included files matching '*' found under directory 'bootloader/build'
warning: no previously-included files matching '*' found under directory 'bootloader/.waf*'
warning: no previously-included files matching '*' found under directory 'bootloader/waf3-*'
warning: no previously-included files found matching 'bootloader/.lock-waf*'
warning: no previously-included files matching '*' found under directory 'doc/source'
warning: no previously-included files found matching 'doc/source'
warning: no previously-included files matching '*' found under directory 'old'
warning: no previously-included files found matching 'old'
warning: no previously-included files matching '*' found under directory 'scripts'
warning: no previously-included files found matching 'scripts'
warning: no previously-included files matching '*' found under directory 'tests/scripts'
warning: no previously-included files found matching 'tests/scripts'
warning: no previously-included files found matching '.*'
warning: no previously-included files found matching '*.yml'
warning: no previously-included files matching '*.pyo' found anywhere in distribution
Installing pyi-bindepend script to /usr/local/bin
Installing pyi-grab_version script to /usr/local/bin
Installing pyi-pprint_toc script to /usr/local/bin
Installing pyinstaller script to /usr/local/bin
Installing pyi-archive_viewer script to /usr/local/bin
Installing pyi-makespec script to /usr/local/bin
Installing pyi-set_version script to /usr/local/bin
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/lib/pefile_py2.py", line 82
IMAGE_ORDINAL_FLAG = 0x80000000L
^
SyntaxError: invalid syntax
Successfully installed pyinstaller
Cleaning up...
pyinstaller file.py
出现错误之后:
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 9, in <module>
load_entry_point('PyInstaller==3.0', 'console_scripts', 'pyinstaller')()
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/__main__.py", line 99, in run
run_build(opts, spec_file, pyi_config)
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/__main__.py", line 47, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **opts.__dict__)
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/building/build_main.py", line 737, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/building/build_main.py", line 680, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/building/build_main.py", line 207, in __init__
self.__postinit__()
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/building/datastruct.py", line 156, in __postinit__
self.assemble()
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/building/build_main.py", line 428, in assemble
imphook_object = ImportHook(imported_name, hook_file)
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/building/imphook.py", line 175, in __init__
self._module = importlib_load_source(hook_modname, self._filename)
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/compat.py", line 492, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap>", line 539, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1614, in load_module
File "<frozen importlib._bootstrap>", line 596, in _load_module_shim
File "<frozen importlib._bootstrap>", line 1220, in load
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/usr/local/lib/python3.4/dist-packages/PyInstaller/hooks/hook-Xlib.py", line 12, in <module>
from PyInstaller import is_unix
ImportError: cannot import name 'is_unix'
(顺便问一下,我需要使用,这正常吗sudo
,pip3
因为没有sudo
它我就无法安装它?)
答案1
导入错误是由于 pyinstaller 无法检测到某些模块。您必须为此明确添加隐藏导入。 https://pythonhosted.org/PyInstaller/hooks.html请查看此处了解更多信息。您可以从应用程序构建目录中生成的警告文件中检查哪些模块未正确导入。