如何修复使用Linux将python脚本转换为.exe时的属性错误

kwvwclae  于 2023-10-16  发布在  Linux
关注(0)|答案(1)|浏览(102)

相对Linux noob在这里。只是想把python代码转换成.exe
当我运行pyinstaller时(安装后第一次),它创建了dist文件,但它是空的。
Error看起来像这样:

48 INFO: PyInstaller: 3.5+498e6ee058
48 INFO: Python: 3.9.9
51 INFO: Platform: Linux-5.14.0-kali4-amd64-x86_64-with-glibc2.33
61 INFO: wrote /home/kali/Py_Projects/turtles.spec
68 INFO: UPX is available.
70 INFO: Extending PYTHONPATH with paths
['/home/kali/Py_Projects', '/home/kali/Py_Projects']
70 INFO: checking Analysis
70 INFO: Building Analysis because Analysis-00.toc is non existent
70 INFO: Initializing module dependency graph...
77 INFO: Initializing module graph hooks...
79 INFO: Analyzing base_library.zip ...
3395 INFO: Processing pre-find module path hook   distutils
8396 INFO: running Analysis Analysis-00.toc
8443 INFO: Caching module hooks...
8447 INFO: Analyzing /home/kali/Py_Projects/turtles.py
8577 INFO: Loading module hooks...
8577 INFO: Loading module hook "hook-distutils.py"...
8579 INFO: Loading module hook "hook-sysconfig.py"...
8587 INFO: Loading module hook "hook-lib2to3.py"...
8588 INFO: Loading module hook "hook-pydoc.py"...
8589 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
8589 INFO: Loading module hook "hook-_tkinter.py"...
8712 INFO: checking Tree
8712 INFO: Building Tree because Tree-00.toc is non existent
8712 INFO: Building Tree Tree-00.toc
8719 INFO: checking Tree
8719 INFO: Building Tree because Tree-01.toc is non existent
8719 INFO: Building Tree Tree-01.toc
8722 INFO: Loading module hook "hook-xml.py"...
8898 INFO: Loading module hook "hook-encodings.py"...
8975 INFO: Looking for ctypes DLLs
9004 INFO: Analyzing run-time hooks ...
9008 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
9014 INFO: Including run-time hook 'pyi_rth__tkinter.py'
9034 INFO: Looking for dynamic libraries
9823 INFO: Looking for eggs
9823 INFO: Python library not in binary dependencies. Doing additional searching...
Traceback (most recent call last):
  File "/usr/bin/pyinstaller", line 11, in <module>
    load_entry_point('PyInstaller==3.5+498e6ee058', 'console_scripts', 'pyinstaller')()
  File "/usr/lib/python3/dist-packages/PyInstaller/__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/usr/lib/python3/dist-packages/PyInstaller/__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "/home/kali/Py_Projects/turtles.spec", line 6, in <module>
    a = Analysis(['turtles.py'],
  File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 243, in __init__
    self.__postinit__()
  File "/usr/lib/python3/dist-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
    self.assemble()
  File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 575, in assemble
    self._check_python_library(self.binaries)
  File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 666, in _check_python_library
    python_lib = bindepend.get_python_library_path()
  File "/usr/lib/python3/dist-packages/PyInstaller/depend/bindepend.py", line 914, in get_python_library_path
    python_libname = findLibrary(name)
  File "/usr/lib/python3/dist-packages/PyInstaller/depend/bindepend.py", line 778, in findLibrary
    utils.load_ldconfig_cache()
  File "/usr/lib/python3/dist-packages/PyInstaller/depend/utils.py", line 375, in load_ldconfig_cache
    path = m.groups()[-1]
AttributeError: 'NoneType' object has no attribute 'groups'

这似乎是一个相当直接的过程,我已经更新了python和pyinstaller.不知道下一步该怎么做。有什么需要帮忙的吗?

wpcxdonn

wpcxdonn1#

我解决这个问题的方法是:https://github.com/pyinstaller/pyinstaller/tree/develop
下载ZIP文件并替换Python目录:/usr/lib/python3/dist-packages/

相关问题