使用Anaconda将.py转换为.exe [英] Converting .py to .exe with Anaconda
问题描述
我使用PyGame制作了一个python程序,该程序仅适用于Python 2.7,因此是我的python版本. 我使用Anaconda是因为它更容易安装模块和使用python,但是该站点还没有2.7的py2exe模块. 还有另一种转换方式吗?或通过某种方式在Anaconda中安装py2exe for 2.7?
I made a python program using PyGame which is only available for Python 2.7 so that is my python version. I am using Anaconda because it is easier to install modules and to use python, but the site hasn't py2exe module for 2.7. Is there another way to convert it? Or some way to install py2exe for 2.7 in Anaconda?
推荐答案
如何使用Windows版Anaconda 3(特别是Anaconda Prompt)创建可执行文件.
How to create an executable using Anaconda 3 (specifically Anaconda Prompt) for Windows.
1-确保在您的Anaconda中安装了pyinstaller
1 - Make sure pyinstaller is installed in your anaconda
pip install pyinstaller
pip install pyinstaller
2-移至python脚本的目录
2 - Move to the directory of your python script
cd C:\ Users .... \ program.py
cd C:\Users....\program.py
3-只需键入以下内容:
3 - Just type the following:
pyinstaller --onefile program.py
pyinstaller --onefile program.py
如果一切顺利,将在您拥有script.py的文件夹中创建多个文件夹,并且可执行文件位于文件夹"dist"内.
If everything goes well, in the folder where you have your script.py you it will be created many folders and your executable is inside folder "dist".
If my explanation is confusing go here: https://medium.com/dreamcatcher-its-blog/making-an-stand-alone-executable-from-a-python-script-using-pyinstaller-d1df9170e263
这篇关于使用Anaconda将.py转换为.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!