Python: как скомпилировать код в *.exe |
|
Добавил(а) microsin
|
Процесс по шагам:
1. Установите пакет PyInstaller:
> pip install pyinstaller
Collecting pyinstaller
Downloading pyinstaller-5.12.0-py3-none-win_amd64.whl (1.3 MB)
---------------------------------------- 1.3/1.3 MB 2.3 MB/s eta 0:00:00
Requirement already satisfied: setuptools>=42.0.0 in c:\python311\lib\site-packages (from pyinstaller) (65.5.0)
Collecting altgraph
Downloading altgraph-0.17.3-py2.py3-none-any.whl (21 kB)
Collecting pyinstaller-hooks-contrib>=2021.4
Downloading pyinstaller_hooks_contrib-2023.3-py2.py3-none-any.whl (263 kB)
---------------------------------------- 263.6/263.6 kB 2.3 MB/s eta 0:00:00
Collecting pefile>=2022.5.30
Downloading pefile-2023.2.7-py3-none-any.whl (71 kB)
---------------------------------------- 71.8/71.8 kB 2.0 MB/s eta 0:00:00
Collecting pywin32-ctypes>=0.2.0
Downloading pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB)
Installing collected packages: pywin32-ctypes, altgraph, pyinstaller-hooks-contrib, pefile, pyinstaller
Successfully installed altgraph-0.17.3 pefile-2023.2.7 pyinstaller-5.12.0 pyinstaller-hooks-contrib-2023.3 pywin32-ctypes-0.2.0
[notice] A new release of pip available: 22.3.1 -> 23.1.2
[notice] To update, run: python.exe -m pip install --upgrade pip
2. Следующая команда создаст исполняемый файл скрипт_на_Python.exe в подкаталоге dist:
> pyinstaller --onefile скрипт_на_Python.py
[Ссылки]
1. Create an Executable using PyInstaller site:datatofish.com. |