Pop Car
Pop Car

Reputation: 363

How do I allow cxfreeze to import colorama?

I'm incredibly new, and I was wondering if I could package colorama with cx_freeze, I've seen some people with a similar question yet I completely do not understand how to specifically choose colorama. Please, explain like I'm 10 years old. This is the coding in my setup.py file for cx_freeze:

from cx_Freeze import setup, Executable``
setup(name = "popcarventure" ,
      version = "0.1" ,
      description = "" ,
      executables = [Executable("TheAdventure.py")])

Can you please post how to specifically import colorama? Much appreciated! Note: I am using python 3.4 on windows, not python 2.

Upvotes: 1

Views: 177

Answers (1)

GSS
GSS

Reputation: 21

I recently started in python too and came across the same problem, aparently the latest version of cxfreeze has difficulties to include compressed modules (.egg, they are similar to .zip files).

So I'm going to try to explain in the easiest way I can, how I managed to get this working.

I assume you installed Python in C:\Python34.

  1. Close any python command line or IDLE GUI.

  2. Go to your Python34 installation folder, it should be on C:\Python34.

  3. Once there open the "Lib" folder and locate "site-packages" folder

  4. Now you need to delete your colorama egg file, this is the file that contains the module it is called colorama-0.3.3.egg or something similar, we need to install it uncompressed.

  5. Create a .cfg file with the instruction to uncompress these egg files during the installation, go to C:\Python34\Lib\distutils create a new notepad file and name it: distutils.cfg and paste this:

    [easy_install]
    zip_ok = 0

Save it and continue with the last step

  1. Open a windows command prompt, write:

    cd C:\python34\scripts

Now you simply write:

pip install colorama

Once it finishes you can start creating executables with colorama on it

NOTE: From now on any egg module you install with pip or easy_install or python install commands, will be uncompressed, so with cx_freeze they will work.

Upvotes: 2

Related Questions