大家写好了python代码一直在工具上面打开是不是觉得很不方便,那么今天呢就给大家提供一个很实用的技巧,就是给python代码打包成可执行的文件。直接点击就可以运行了,那么究竟是怎么打包的呢,跟着我一步步来看
- 首先win+R,输入cmd,点击确定
- 执行命令pip install pyinstaller
- 进入到想要打包文件的所在目录,我的是在桌面,所以命令是cd Desktop/translate
-
- 执行命令 pyinstaller -F -w main.py
- 有了成功字样就说明打包成功了,接下来打开目录,其中新增的dist里面就是我们的exe文件了 大家看到在生成exe文件的时候用到了参数,我这边也是把基本的参数列举了一下,大家可以参考一下哈 参数 用法 -F 生成结果是一个 exe 文件,所有的第三方依赖、资源和代码均被打包进该 exe 内 -D 生成结果是一个目录,各种第三方依赖、资源和 exe 同时存储在该目录(默认) -a 不包含unicode支持 -d 执行生成的 exe 时,会输出一些log,有助于查错 -w 不显示命令行窗口 -c 显示命令行窗口(默认) -p 指定额外的 import 路径,类似于使用 python path -i 指定图标 -v 显示版本号 -n 生成的 .exe 的文件名
I like the valuable information you provide
in your articles. I’ll bookmark your weblog and check again here regularly.
I am quite certain I’ll learn a lot of new stuff right here!
Good luck for the next!
It is not my first time to go to see this web site, i am browsing this web page dailly and get pleasant data from here everyday.
Howdy just wanted to give you a quick heads up.
The text in your article seem to be running off the
screen in Safari. I’m not sure if this is a format issue or something to do with browser compatibility but I figured I’d post to let you
know. The design look great though! Hope you get the
issue fixed soon. Cheers
Hello my family member! I wish to say that this post is awesome, great written and
come with almost all significant infos. I’d like to see more posts like this .
colchicine drug price
propecia canadian pharmacy