我正在尝试在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"
。
对于x86,我的Python版本是2.7.13。
答案 0 :(得分:1)
我遇到了同样的问题,显然是由我的(Windows 7)用户名包含''字符引起的。我的解决方法是在Windows中使用管理员权限创建第二个用户名,从中我可以生成可执行文件而没有任何错误。