概述
打包Python文件成.exe程序。
方法一:
pyinstaller -F one.py
(torch) C:UsersAdministrator>
pyinstaller -F D:pythoncodespytorchlearningpaper3.py
方法二:auto-py-to-exe
1、安装
pip3 install auto-py-to-exe
(base) C:UsersAdministrator>pip3 install auto-py-to-exe
Collecting auto-py-to-exe
Using cached auto_py_to_exe-2.31.1-py2.py3-none-any.whl (106 kB)
Requirement already satisfied: pyinstaller>=5.8.0 in d:softeraanacondalibsite-packages (from auto-py-to-exe) (5.8.0)
Collecting Eel==0.14.0
Using cached Eel-0.14.0.tar.gz (17 kB)
Preparing metadata (setup.py) ... done
Collecting bottle
Using cached bottle-0.12.24-py3-none-any.whl (90 kB)
Collecting bottle-websocket
Using cached bottle-websocket-0.2.9.tar.gz (2.0 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: future in d:softeraanacondalibsite-packages (from Eel==0.14.0->auto-py-to-exe) (0.18.2)
Requirement already satisfied: pyparsing in d:softeraanacondalibsite-packages (from Eel==0.14.0->auto-py-to-exe) (3.0.9)
Collecting whichcraft
Using cached whichcraft-0.6.1-py2.py3-none-any.whl (5.2 kB)
Requirement already satisfied: setuptools>=42.0.0 in d:softeraanacondalibsite-packages (from pyinstaller>=5.8.0->auto-py-to-exe) (63.4.1)
Requirement already satisfied: pefile>=2022.5.30 in d:softeraanacondalibsite-packages (from pyinstaller>=5.8.0->auto-py-to-exe) (2023.2.7)
Requirement already satisfied: pyinstaller-hooks-contrib>=2021.4 in d:softeraanacondalibsite-packages (from pyinstaller>=5.8.0->auto-py-to-exe) (2023.0)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in d:softeraanacondalibsite-packages (from pyinstaller>=5.8.0->auto-py-to-exe) (0.2.0)
Requirement already satisfied: altgraph in d:softeraanacondalibsite-packages (from pyinstaller>=5.8.0->auto-py-to-exe) (0.17.3)
Collecting gevent-websocket
Using cached gevent_websocket-0.10.1-py3-none-any.whl (22 kB)
Collecting gevent
Downloading gevent-22.10.2-cp39-cp39-win_amd64.whl (1.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 37.2 kB/s eta 0:00:00
Requirement already satisfied: zope.interface in d:softeraanacondalibsite-packages (from gevent->gevent-websocket->bottle-websocket->Eel==0.14.0->auto-py-to-exe) (5.4.0)
Requirement already satisfied: cffi>=1.12.2 in d:softeraanacondalibsite-packages (from gevent->gevent-websocket->bottle-websocket->Eel==0.14.0->auto-py-to-exe) (1.15.1)
Collecting zope.event
Using cached zope.event-4.6-py2.py3-none-any.whl (6.8 kB)
Collecting greenlet>=2.0.0
Downloading greenlet-2.0.2-cp39-cp39-win_amd64.whl (192 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 192.1/192.1 kB 44.8 kB/s eta 0:00:00
Requirement already satisfied: pycparser in d:softeraanacondalibsite-packages (from cffi>=1.12.2->gevent->gevent-websocket->bottle-websocket->Eel==0.14.0->auto-py-to-exe) (2.21)
Building wheels for collected packages: Eel, bottle-websocket
Building wheel for Eel (setup.py) ... done
Created wheel for Eel: filename=Eel-0.14.0-py3-none-any.whl size=17439 sha256=f303222b2bfeed7cc5670e5ddf225eb5f3e9beda3e5f56fb43c1910012966f4c
Stored in directory: c:usersadministratorappdatalocalpipcachewheelsf1c25c5f6bc6e4a71a5ea3c3d9b46f832e1ca0a2a66d229c4efb13c9
Building wheel for bottle-websocket (setup.py) ... done
Created wheel for bottle-websocket: filename=bottle_websocket-0.2.9-py3-none-any.whl size=2330 sha256=47171a0a4a97a81c6452bad797908a56974d6ae0f03990d34e608314b67f1bcc
Stored in directory: c:usersadministratorappdatalocalpipcachewheels3f0389b62449b34a0c944daa3c7ae993e2d9a97096b22a2c9d4bd49b
Successfully built Eel bottle-websocket
Installing collected packages: whichcraft, bottle, zope.event, greenlet, gevent, gevent-websocket, bottle-websocket, Eel, auto-py-to-exe
Attempting uninstall: greenlet
Found existing installation: greenlet 1.1.1
Uninstalling greenlet-1.1.1:
Successfully uninstalled greenlet-1.1.1
Successfully installed Eel-0.14.0 auto-py-to-exe-2.31.1 bottle-0.12.24 bottle-websocket-0.2.9 gevent-22.10.2 gevent-websocket-0.10.1 greenlet-2.0.2 whichcraft-0.6.1 zope.event-4.6
2、使用
输入使用
进行中…
成功
文件:
最后
以上就是单纯鲜花为你收集整理的用vscode打包python,生成exe的全部内容,希望文章能够帮你解决用vscode打包python,生成exe所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复