[Solved] Converting .py to .exe with Anaconda

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?

Solution #1:

How to create an executable using Anaconda 3 (specifically Anaconda Prompt) for Windows.

1 – Make sure pyinstaller is installed in your anaconda

pip install pyinstaller

2 – Move to the directory of your python script

cd C:Users….program.py

3 – Just type the following:

pyinstaller –onefile program.py

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

Respondent: Rui Filipe

Solution #2:

Instead of using py2exe you could try to build your executable with pyinstaller.

http://www.pyinstaller.org/downloads.html

The PyGame package is also supported with pyinstaller according to this link

https://github.com/pyinstaller/pyinstaller/wiki/Supported-Packages

Respondent: Marcel S.

Solution #3:

Another solution is Conda Constructor.

Constructor is a tool which allows constructing an installer for a collection of conda packages. It solves needed packages using user-provided specifications, and bundles those packages. It can currently create 3 kinds of installers, which are best thought of as delivery vehicles for the bundled packages. There are shell installers, MacOS .pkg installers, and Windows .exe installers. Each of these will create an environment on the end user’s system that contains the specs you provided, along with any necessary dependencies. These installers are similar to the Anaconda and Miniconda installers, and indeed constructor is used to create those installers.

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.