pyautogui的pyinstaller问题

时间:2019-06-28 01:19:04

标签: pyqt5 python-3.6 pyinstaller pyautogui

我正在尝试使用pyinstaller将python脚本转换为.exe。

我发现导致错误的模块是“ pyautogui”。 当我排除“ pyautogui”而没有任何问题时,我可以转换所有其他脚本。

Python版本:3.6

Pyinstaller版本:3.4

我的测试文件也会触发相同的错误

import pyautogui

print("Test")

anaconda提示符中的命令行:

pyinstaller --onefile -w pyexe_for_bot.py

命令行输出:

78 INFO: PyInstaller: 3.4
78 INFO: Python: 3.6.0
78 INFO: Platform: Windows-10-10.0.17763-SP0
84 INFO: wrote F:\Projects\Test\pyexe_for_bot.spec
85 INFO: UPX is not available.
87 INFO: Extending PYTHONPATH with paths
['F:\\Projects\\Test', 'F:\\Projects\\Test']
87 INFO: checking Analysis
88 INFO: Building Analysis because Analysis-00.toc is non existent
88 INFO: Initializing module dependency graph...
91 INFO: Initializing module graph hooks...
93 INFO: Analyzing base_library.zip ...
4219 INFO: running Analysis Analysis-00.toc
4242 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by f:\anaconda\python.exe
4581 INFO: Caching module hooks...
4596 INFO: Analyzing F:\Projects\Test\pyexe_for_bot.py
6053 INFO: Processing pre-find module path hook   distutils
8019 INFO: Processing pre-find module path hook   site
8020 INFO: site: retargeting to fake-dir 'f:\\anaconda\\lib\\site-packages\\PyInstaller\\fake-modules'
10965 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
15639 INFO: Processing pre-safe import module hook   six.moves
20697 INFO: Loading module hooks...
20698 INFO: Loading module hook "hook-Crypto.py"...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'Crypto.Math'
20764 INFO: Loading module hook "hook-cv2.py"...
20765 INFO: Loading module hook "hook-distutils.py"...
20767 INFO: Loading module hook "hook-encodings.py"...
20871 INFO: Loading module hook "hook-lib2to3.py"...
20876 INFO: Loading module hook "hook-numpy.core.py"...
20959 INFO: MKL libraries found when importing numpy. Adding MKL to binaries
20962 INFO: Loading module hook "hook-numpy.py"...
20963 INFO: Loading module hook "hook-PIL.Image.py"...
21495 INFO: Loading module hook "hook-PIL.py"...
21498 INFO: Excluding import 'PyQt4'
21501 INFO:   Removing import of PyQt4 from module PIL.ImageQt
21502 INFO: Excluding import 'tkinter'
21505 INFO:   Removing import of tkinter from module PIL.ImageTk
21506 INFO: Excluding import 'PyQt5'
21510 INFO:   Removing import of PyQt5.QtCore from module PIL.ImageQt
21510 INFO:   Removing import of PyQt5.QtGui from module PIL.ImageQt
21511 INFO: Excluding import 'PySide'
21514 INFO:   Removing import of PySide from module PIL.ImageQt
21515 INFO: Import to be excluded not found: 'FixTk'
21515 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
21519 INFO: Excluding import 'tkinter'
21522 INFO: Import to be excluded not found: 'FixTk'
21522 INFO: Loading module hook "hook-pkg_resources.py"...
22208 INFO: Processing pre-safe import module hook   win32com
22603 INFO: Loading module hook "hook-pycparser.py"...
22894 INFO: Loading module hook "hook-pydoc.py"...
22895 INFO: Loading module hook "hook-PyQt5.py"...
22978 WARNING: Cannot read QLibraryInfo output: raised Expecting value: line 1 column 1 (char 0) when decoding:
Traceback (most recent call last):
  File "<string>", line 11, in <module>
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
Traceback (most recent call last):
  File "f:\anaconda\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "f:\anaconda\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "F:\Anaconda\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
  File "f:\anaconda\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "f:\anaconda\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "f:\anaconda\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "f:\anaconda\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 17, in <module>
  File "f:\anaconda\lib\site-packages\PyInstaller\building\build_main.py", line 241, in __init__
    self.__postinit__()
  File "f:\anaconda\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "f:\anaconda\lib\site-packages\PyInstaller\building\build_main.py", line 500, in assemble
    module_hook.post_graph()
  File "f:\anaconda\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
    self._load_hook_module()
  File "f:\anaconda\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
    self.hook_module_name, self.hook_filename)
  File "f:\anaconda\lib\site-packages\PyInstaller\compat.py", line 736, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 823, in load_module
  File "<frozen importlib._bootstrap_external>", line 682, in load_module
  File "<frozen importlib._bootstrap>", line 251, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 675, in _load
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "f:\anaconda\lib\site-packages\PyInstaller\hooks\hook-PyQt5.py", line 23, in <module>
    collect_system_data_files(pyqt5_library_info.location['PrefixPath'],
  File "f:\anaconda\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 67, in __getattr__
    qli = json.loads(json_str)
  File "f:\anaconda\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "f:\anaconda\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "f:\anaconda\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

有人知道如何解决此问题吗?

0 个答案:

没有答案