怎么改格式
怎么把py格式的文件改成exe{:9_241:} 需要安装 pyinstaller 模块,然后打包成 exe 可执行文件:python -m pip install pyinstaller -i https://pypi.tuna.tsinghua.edu.cn/simple
打包流程:
将 需要打包的文件放一起 比如 我在 C盘创个py文件夹脚本为 x.py 图标为 z.ico (如果不设置图标,那么代码中就不用 -i 和 z.ico)
1. 打开 cmd 窗口 输入将工作目录切换到py文件夹下cd C:\py
2.输入 pyinstaller -F -i z.ico x.py 回车进行打包操作
3.打包完成后在 dist 文件夹下可找到 exe 程序
Ps: 若是 gui 界面程序 建议 -F前面加上 -w 可隐藏 cmd 窗口运行 Twilight6 发表于 2020-7-12 08:39
需要安装 pyinstaller 模块,然后打包成 exe 可执行文件:
在安装的时候会报错诶ERROR: Command errored out with exit status 1:
command: 'E:\软件\Python\python.exe' 'E:\软件\Python\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\HYZJ\AppData\Local\Temp\tmpvr5q0jif'
cwd: C:\Users\HYZJ\AppData\Local\Temp\pip-install-04xs2iae\pyinstaller
Complete output (36 lines):
running dist_info
creating C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info
writing C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info\PKG-INFO
writing dependency_links to C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info\dependency_links.txt
writing entry points to C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info\entry_points.txt
writing requirements to C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info\requires.txt
writing top-level names to C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info\top_level.txt
writing manifest file 'C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
Error in sitecustomize; set PYTHONVERBOSE for traceback:
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xc8 in position 0: invalid continuation byte (sitecustomize.py, line 7)
no previously-included directories found matching 'bootloader\build'
no previously-included directories found matching 'bootloader\.waf-*'
no previously-included directories found matching 'bootloader\.waf3-*'
no previously-included directories found matching 'bootloader\waf-*'
no previously-included directories found matching 'bootloader\waf3-*'
no previously-included directories found matching 'bootloader\_sdks'
no previously-included directories found matching 'bootloader\.vagrant'
warning: no previously-included files found matching 'bootloader\.lock-waf*'
no previously-included directories found matching 'doc\source'
no previously-included directories found matching 'doc\_build'
warning: no previously-included files matching '*.tmp' found under directory 'doc'
warning: no files found matching 'news\_template.rst'
no previously-included directories found matching 'news'
no previously-included directories found matching 'old'
no previously-included directories found matching 'scripts'
no previously-included directories found matching 'tests\scripts'
no previously-included directories found matching '.github'
warning: no previously-included files found matching '.*'
warning: no previously-included files found matching '*.yml'
warning: no previously-included files found matching '*~'
warning: no previously-included files found matching '.directory'
writing manifest file 'C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.egg-info\SOURCES.txt'
creating 'C:\Users\HYZJ\AppData\Local\Temp\pip-modern-metadata-70204pa5\PyInstaller.dist-info'
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Command errored out with exit status 1: 'E:\软件\Python\python.exe' 'E:\软件\Python\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\HYZJ\AppData\Local\Temp\tmpvr5q0jif' Check the logs for full command output. WJYjiayi 发表于 2020-7-12 08:42
在安装的时候会报错诶
你用的是 IDLE 还是? Twilight6 发表于 2020-7-12 08:43
你用的是 IDLE 还是?
cmd
WJYjiayi 发表于 2020-7-12 08:44
cmd
我问的是你用的编辑器 Twilight6 发表于 2020-7-12 08:44
我问的是你用的编辑器
IDLE WJYjiayi 发表于 2020-7-12 08:42
在安装的时候会报错诶
那就去 https://pypi.tuna.tsinghua.edu.cn/simple 网站里面下载下 pyinstaller 的 whl 安装文件(网站 CTRL+F 可以查找关键字),保存到桌面
注意:选择正确的版本,比如 cp38 就是指 3.8 版本的 Python
然后下载到桌面,打开 cmd 输入 cd Desktop 然后回车
然后输入 pip install 文件名.whl
这里的文件名就是你下载的 whl 文件名 Twilight6 发表于 2020-7-12 08:46
那就去 https://pypi.tuna.tsinghua.edu.cn/simple 网站里面下载下 pyinstaller 的 whl 安装文件(网站...
只有pyinstaller_wheel啊 WJYjiayi 发表于 2020-7-12 08:54
只有pyinstaller_wheel啊
你再试试这个,网站那边先不找:
python -m pip install PyInstaller -i https://pypi.tuna.tsinghua.edu.cn/simple Twilight6 发表于 2020-7-12 09:05
你再试试这个,网站那边先不找:
不管啊 WJYjiayi 发表于 2020-7-12 09:07
不管啊
我帮你下载了 骚等吧 本帖最后由 hrp 于 2020-7-12 10:12 编辑
WJYjiayi 发表于 2020-7-12 09:07
不管啊
去这里下载 zip 压缩包,解压,将解压的文件放至桌面,然后在去 cmd 按照 8L 操作
https://wwe.lanzous.com/itLc1ej7yba Twilight6 发表于 2020-7-12 09:14
去这里下载 zip 压缩包,解压,将解压的文件放至桌面,然后在去 cmd 按照 8L 操作
https://wwe.la ...
他回复了一个pyinstaller: error: the following arguments are required: scriptname {:10_266:} WJYjiayi 发表于 2020-7-12 09:21
他回复了一个
你输入的命令发我看看 001 - 【python】如何用命令提示符把.py转成.exe
https://fishc.com.cn/thread-117775-1-1.html
(出处: 鱼C论坛)
Twilight6 发表于 2020-7-12 09:28
你输入的命令发我看看
不好意思,输错了{:10_282:} WJYjiayi 发表于 2020-7-12 09:36
不好意思,输错了
{:10_287:} 成功了就好
页:
[1]