[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
写完一个Python程序想给朋友看?朋友电脑里没Python运行不了?
别急,这篇文章来帮你。
把你的python文件转成exe文件,打开方便,瞬间提示一个档次。
(我个人也遇到过这样的问题,看了别人的博客解决了,现在自己再写一篇)
第一步:安装pyinstaller
这个要先打开命令行(win+R输入cmd)然后输入:
pip install pyinstaller
二、打包exe文件
把你要转的py文件放到指定的地方(比如说桌面)
然后打开命令行,定位到桌面
cd desktop
这样你会发现你命令行前面的提示改变了:
然后继续输入(以我的aaa.py为例,就输入:
pyinstaller -F aaa.py
里面有几个参数可以选用,要用的话依次输入
-F (这个是生成exe文件的,必须要有)
-w (这个主要是解决打包后,运行文件会有黑框,建议加上)
-i (这个是用于替换你的图标,把文件图标替换成你想要的样子,可加可不加)
这样文件就会自动封装打包成exe文件,最后生成的相关文件都存在桌面上的文件夹中,找一找就彳亍了。
这样,这个文件就可以在没有安装Python的电脑上运行了~~~
那就下期再见
等等,别走!
(我看其他博主的类似文章下面有人问如果py引入了调用三方库怎么办)
完全不用担心,经过测试 ,exe文件已经把你用到的库打包进去了。
好,真的没了。
-------------------------------------------------THE------------END--------------------------------------------------------