使用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 ...
随机推荐
- hadoop 使用ip配置导致hdfs启动失败
dataNode 有守护进行,但hdfs web页面上显示没有live node. 错误日志: 2017-06-21 17:44:59,513 ERROR org.apache.hadoop.hdfs ...
- IIS 未能加载文件或程序集“System.Web.Mvc, Version=5.2
MVC配置不正确 1. 应用程序池配置成经典模式, 2. 程序池高级设置32位模式. 3.MVC目录设置不网站根目录 ,不要设置为VIEWS目录下.
- 洛谷P1147 连续自然数和【二分】
题目:https://www.luogu.org/problemnew/show/P1147 题意: 给定一个数m,问有多少个数对$(i,j)$,使得$i$到$j$区间的所有整数之和为m.输出所有的解 ...
- Linux系统下公式编辑器KLatexFormula
方法1:源码安装 https://blog.csdn.net/ouening/article/details/79008636 方法2:通过apt-get 安装 首先安装libqt4-sql-sqli ...
- select cast(round(12.5,2) as numeric(5,2))
http://www.jb51.net/article/74284.htm 解释: round()函数,是四舍五入用,第一个参数是我们要被操作的数据,第二个参数是设置小数四舍五入的精度. )--32. ...
- 关于Java的基础语法整理
- python-----实现接口自动化测试(实例4)
实现接口自动化测试1.读取case---从测试用例Excel表格中读取接口请求数据2.调用接口---发送请求获取实际结果3.校验结果---实际结果与预期结果对比4.结果写入表格---将实际结果与测试状 ...
- 关于ionic2 更新到ionic3 后组件不能用的解决方案
错误代码就不贴出来了,直接上代码吧! 首先在xx.module.ts添加 1.import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2.添加 ...
- saltstack---自动化运维平台
https://github.com/ixrjog/adminset[自动化运维平台:CMDB.CD.DevOps.资产管理.任务编排.持续交付.系统监控.运维管理.配置管理 ] https://ww ...
- 转:HashMap实现原理分析(面试问题:两个hashcode相同 的对象怎么存入hashmap的)
原文地址:https://www.cnblogs.com/faunjoe88/p/7992319.html 主要内容: 1)put 疑问:如果两个key通过hash%Entry[].length得 ...