Sign in to follow this  

Compiling a Python script

This topic is 3043 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is a message for Python experts. I want to create an executable program from a Python script, which I am importing "os" in the module. I've tried to use py2exe, however, when I compile, via "python setup.py py2exe," I receive an error, "ImportError: No module named os." I also receive an error: "ImportError: No module named linecache," which I didn't call. How would I include these modules, if they are required, or would another method of creating a stand-alone Python executable be advised, such as freeze.py? Thanks, Walter

Share this post


Link to post
Share on other sites
Do you have add the python module path to the enviroment var PYTHONPATH? Normally you can find the basic modules like os in <Home_of_your_python_installation>\lib . Make sure that this directories are set to your PYTHONPATH-variable.

For some more detailed infos take a look into this didscussion:
How to change sys.path.

Kimmi

Share this post


Link to post
Share on other sites
To Kimmi:

Thanks for your input - this worked! I created the enviroment variable PYTHONPATH, and inserted the path to the Python library. I had to also move my code out of the #def modules I made for the program to run as an executable.

Thanks,
Walter

Share this post


Link to post
Share on other sites

This topic is 3043 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this