Python 3.5 + PyInstaller 3.2.1打包exe出错,TypeError: read() takes no keyword arguments
来源:互联网 发布:mac键盘使用技巧 编辑:程序博客网 时间:2024/06/11 14:21
Python脚本发布为脱离Python平台运行的可执行程序,比如单个的exe文件,PyInstaller是一个好的选择。
安装了 Python 3.5 + PyInstaller 3.2.1,py文件使用了UTF-8无BOM保存,打包exe时出现下面的错误:
Traceback (most recent call last): File "D:\code\Python\Python35-32\Scripts\pyinstaller-script.py", line 11, in <module> load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')() File "D:\code\Python\Python35-32\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstaller\__main__.py", line 90, in run run_build(pyi_config, spec_file, **vars(args)) File "D:\code\Python\Python35-32\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstaller\__main__.py", line 46, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "D:\code\Python\Python35-32\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstaller\building\build_main.py", line 788, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "D:\code\Python\Python35-32\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstaller\building\build_main.py", line 734, in build exec(text, spec_namespace) File "<string>", line 28, in <module> File "D:\code\Python\Python35-32\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstaller\building\api.py", line 388, in __init__ self.console, self.uac_admin, self.uac_uiaccess) File "D:\code\Python\Python35-32\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstaller\utils\win32\winmanifest.py", line 1076, in create_manifest old_xml = f.read()UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 172: illegal multibyte sequence
按提示打开文件:D:\code\Python\Python35-32\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstaller\utils\win32\winmanifest.py,找到1076行附近:
1074 if not need_new:1075 with open(filename) as f:1076 old_xml = f.read()1077 new_xml = manifest.toprettyxml().replace('\r','')10781079 # this only works if PYTHONHASHSEED is set in environment1080 need_new = (old_xml != new_xml)
将其中的1075行改为:
1075 with open(filename,encoding="UTF-8") as f:
再次打包exe,这次正常无问题。
22163 INFO: checking EXE22164 INFO: Building EXE because out00-EXE.toc is non existent22164 INFO: Building EXE from out00-EXE.toc22165 INFO: Appending archive to EXE Z:\dist\文件对话框.exe22201 INFO: Building EXE from out00-EXE.toc completed successfully.
-
0 0
- Python 3.5 + PyInstaller 3.2.1打包exe出错,TypeError: read() takes no keyword arguments
- python之TypeError: this constructor takes no arguments
- python:TypeError: this constructor takes no arguments解决方法
- TypeError: this constructor takes no arguments(Python 学习遇到的错误1)
- python 使用装饰器提示:TypeError: wrapper() takes no arguments (1 given)
- TypeError: this constructor takes no arguments
- TypeError: this constructor takes no arguments
- TypeError: this constructor takes no arguments
- python "TypeError: object() takes no parameters"
- pyinstaller打包python成exe
- python打包exe之pyinstaller
- 运行python 时出现TypeError: obj() takes no parametrs
- python报错 TypeError: object() takes no parameters
- TypeError: object() takes no parameters
- TypeError: object() takes no parameters
- TypeError: object() takes no parameters
- TypeError: object() takes no parameters
- pyinstaller--将python打包成exe
- 安迪的第一个字典uva10815
- javaScript---oop
- Echarts折柱图异步加载
- ZCMU—H
- struts2
- Python 3.5 + PyInstaller 3.2.1打包exe出错,TypeError: read() takes no keyword arguments
- 解决ScrollView里嵌套 RecyclerVIew 时,RecyclerVIew 滑动不流畅的问题
- 利用js获取客户端ip的方法
- Centos 7 安装 OpenResty api 网关 Orange
- 3.3java面试笔试题
- Install Oracle Database 12cR2 On Oracle Enterprise Linux7.3
- eclipse导入jar包
- IDEA中多行注释及取消注释快捷键
- 谷歌技术"三宝"之MapReduce