使用Pyinstaller打包python py文件注意事项
首先需要将cmd或者PowerShell目录cd 跳转到py脚本所在目录,然后直接执行 Pyinstaller -F即可完成程序的打包,其中我们关心它有哪些常见参数:
输入参数的含义
-F 表示生成单个可执行文件
-w 表示去掉控制台窗口,这在GUI界面时非常有用。不过如果是命令行程序的话那就把这个选项删除吧!
-p 表示你自己自定义需要加载的类路径,一般情况下用不到
-i 表示可执行文件的图标
- 不过顺序上有要求,如果想要修改默认图标,正确的写法是:Pyinstaller -F -w -i "ico文件完整路径" "py文件完整路径”,否则经常编译出错。
- 如果编译报"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 5650: invalid start byte",可尝试在powershell下输入:chcp 65001。
- 常见报错如下:
- 171 INFO: checking Analysis
171 INFO: Building Analysis because out00-Analysis.toc is non existent
171 INFO: Initializing module dependency graph...
187 INFO: Initializing module graph hooks...
187 INFO: Analyzing base_library.zip ...
5538 INFO: running Analysis out00-Analysis.toc
5553 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by d:\program files\python35\python.exe
6380 INFO: Caching module hooks...
6380 INFO: Analyzing D:\photo.ico
Traceback (most recent call last):
File "D:\Program Files\python35\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.3.1', 'console_scripts', 'pyinstaller')()
File "d:\program files\python35\lib\site-packages\PyInstaller\__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
File "d:\program files\python35\lib\site-packages\PyInstaller\__main__.py", line 46, in run_bu
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "d:\program files\python35\lib\site-packages\PyInstaller\building\build_main.py", line 79
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "d:\program files\python35\lib\site-packages\PyInstaller\building\build_main.py", line 73
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "d:\program files\python35\lib\site-packages\PyInstaller\building\build_main.py", line 21
self.__postinit__()
File "d:\program files\python35\lib\site-packages\PyInstaller\building\datastruct.py", line 16
self.assemble()
File "d:\program files\python35\lib\site-packages\PyInstaller\building\build_main.py", line 41
priority_scripts.append(self.graph.run_script(script))
File "d:\program files\python35\lib\site-packages\PyInstaller\depend\analysis.py", line 201, i
self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
File "d:\program files\python35\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py",
t
contents = fp.read() + '\n'
File "d:\program files\python35\lib\codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 5650: invalid start byte
使用Pyinstaller打包python py文件注意事项的更多相关文章
- “failed to excute script xxx” PyInstaller 打包python程序为exe文件过程错误
在使用PyInstaller打包python程序,打包命令为: pyinstaller -F -w -i manage.ico yourpyfile.py 顺便说一下几个参数的作用 -F:是直接生成单 ...
- pyinstaller打包python文件成exe(原理.安装.问题)
py文件打包成exe文件的方式一共有三种:py2exe.PyInstaller和cx_Freeze 本文分四个步骤来详讲如何用PyInstaller将py文件打包成exe文件 1. PyInstall ...
- 使用pyinstaller打包Python应用,生成EXE执行文件
在命令行中切换到要打包的程序所在目录,或者在程序目录打开命令行,直接输入下面的指令即可pyinstaller -F xxx.py pyinstaller -F -w -i manage.ico app ...
- PyInstaller 打包 python程序成exe
pychaim下PyInstaller 打包 python程序 主题是使用PyInstaller 打包python时遇到一些问题以及解决方案,其中将要打包的程序是用tensorflow做的LSTM算法 ...
- PyInstaller打包python脚本的一些心得
PyInstaller打包python脚本的一些心得 因为在公司经常要帮同事做一个从excel表格中提取出需要的内容的重复工作,比较繁琐还容易出错:于是就想着要写个程序,但是同事又不可能在电脑上也装上 ...
- 安装PyInstaller打包python
安装PyInstaller 对于那些网络比较稳定,能够流畅使用pip源地址的用户,直接下面的命令就可以搞定: pip install pyinstaller 通常我们会下载源码包,然后进入包目录,执行 ...
- 运行 python *.py 文件出错,如:python a.py
运行 python *.py 文件出错,如:python a.py(下图) 原因:没有安装web.py 解决:下载并安装 网址:http://webpy.org/install#install (h ...
- python用pyinstaller打包成exe文件
版本为Python2.7 一.安装Pyinstaller 1.安装pywin32 下载安装文件:查找到跟自己适用的python版本及window系统版本匹配的pywin32,下载后安装 使用pip命 ...
- win7 32位用pyinstaller打包Python和相关html文件 成exe
http://tieba.baidu.com/p/3060401749?traceid= 安装 pyinstaller 然后 第一步你的脚本里面要做相应处理,添加一个函数:def resource_p ...
随机推荐
- B - Hamburgers
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own han ...
- CentOS7.5 Linux搭建全文检索--Solr7.4.0单机服务
一.Solr安装环境 1.官方参考文档 Solr教程参考指南:http://lucene.apache.org/solr/guide/7_4/solr-tutorial.html 2.Solr运行环境 ...
- 新装的MySQL没有密码怎么办
新装的mysql没有密码怎么办 [root@localhost log]# mysql -u root -p Enter password: Welcome to the MySQL monitor. ...
- ThinkPHP框架 表单传值自动验证!!
如果有多个字段都包含错误,默认只显示一个错误.如果想显示全部错误,可以设置属 性: //批量验证 d protected $patchValidate = true; 如果是直接 POST 过来的,直 ...
- Mongodb----整理
----------------------------------------------------------------------------------mongodb基本操作------- ...
- NFS文件服务器搭建
NFS(Network File System)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源.在NFS的应用中,本地NFS的客户端应用可 ...
- 壁虎书5 Support Vector Machine
SVM is capable of performing linear or nonlinear classification,regression,and even outlier detectio ...
- 证书文件(pfx)读取时报 “指定的网络密码不正确”
实际情况: 1.本地测试正确,发布到windows server 2003 iis6 可以正常运行 发布到 windows server 2008 上 II7就报 “指定的网络密码不正确” 日志报错为 ...
- 2017-2018 ACM-ICPC Latin American Regional Programming Contest
题面pdfhttps://codeforc.es/gym/101889/attachments/download/7471/statements-2017-latam-regional.pdf zyn ...
- python 全排列combinations和permutations函数
结果为: 显然,combinations方法重点在组合,permutations方法重在排列. 还有就是,combinations和permutations返回的是对象地址,原因是在python3里面 ...