【问题标题】:PyInstaller error on WindowsWindows 上的 PyInstaller 错误
【发布时间】:2017-08-15 00:59:21
【问题描述】:

我正在尝试在 Windows 上使用 PyInstaller 编译一些脚本。

脚本使用 PySide 和 OpenPyXL 库。我使用 PIP 安装了所有依赖项(PySide、OpenPyXL、PEFILE 和 PyInstaller)。

我的脚本没有使用任何 unicode 字符,但是当我尝试执行 PyInstaller 时,它会显示下一个 Traceback 错误:

Traceback (most recent call last):
  File "C:\Python27\Scripts\pyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
  File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line 788, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line 734, in build
    exec(text, spec_namespace)
  File "<string>", line 33, in <module>
  File "c:\python27\lib\site-packages\PyInstaller\building\api.py", line 650, in __init__
    self.__postinit__()
  File "c:\python27\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
    self.assemble()
  File "c:\python27\lib\site-packages\PyInstaller\building\api.py", line 682, in assemble
    dist_nm=inm)
  File "c:\python27\lib\site-packages\PyInstaller\building\utils.py", line 190, in checkCache
    cachedfile = os.path.join(cachedir, basenm)
  File "c:\python27\lib\ntpath.py", line 86, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xed in position 16: ordinal not in range(128)

脚本路径为"C:\extractorcfdi\extractorcfdi.pyw"

我的 Python 版本是 2.7.13 for x86。

【问题讨论】:

  • 您可能需要将脚本路径指定为"C:\\extractorcfdi\\extractorcfdi.pyw"(或r"C:\extractorcfdi\extractorcfdi.pyw")。

标签: python windows pyside pyinstaller openpyxl


【解决方案1】:

我遇到了同样的问题,这显然是由我的 (Windows 7) 用户名​​包含“ñ”字符引起的。我的解决方法是在 Windows 中创建具有管理员权限的第二个用户名,我可以从中生成可执行文件而不会出现任何错误。

【讨论】:

    猜你喜欢
    • 2021-05-30
    • 2016-06-11
    • 1970-01-01
    • 2018-10-15
    • 1970-01-01
    • 2023-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多