When I try to compile and .exe I get ImportError:

2019-07-22 05:40发布

问题:

I've tried making an exe from a program using py2exe, cx_freeze and pyinstaller. All of which give me an error 'ImportError: No module named six' when I go to launch the .exe

The .exe is able to be created. I've looked through the forums and all of them say to pip install six (it's already installed). I've tried uninstalling and re-installing six.

One post mentioned uninstalling matplotlib, so I did that.

When I instlalled pyinstaller one of the requirements was that six be installed! So this is very baffling.

回答1:

http://i289.photobucket.com/albums/ll233/89733/stacked_help_zpsnrvlayj4.jpg

After Gabriel asked for the screenshot I took a closer look.

pip install urllib3 --upgrade solved the issue, which I found here:

https://github.com/transifex/transifex-client/issues/103



回答2:

When you create a .exe file using cx_freeze it kind of compiles all the needed libraries into the .exe folder, you probably had to configurate a setup file from cx_freeze to be able to create the .exe, right? There you must "tell" cx_freeze which libraries are going to be needed when someone runs the program.

Keep in mind that when you create a .exe you dont need to have python neither six to run it.