I'm trying use py2exe on a program that imports urlparse
from six.moves.urllib_parse
. Here is the program:
# hello.py
from six.moves.urllib_parse import urlparse
print('hello world')
And here is my setup.py:
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
Running hello.py works fine. When I compile hello.py into an exe using python setup.py py2exe
, a hello.exe
file is produced. However, when I run hello.exe
I get an error saying:
ImportError: No module named urlparse
I'm using Python 2.7.
With Python 3.4, I get an error saying KeyError: 'six.moves'
when running python setup.py py2exe
.
How can I stop these errors from occurring?