Skip to content Skip to sidebar Skip to footer

Python Command Line Import Error

I'm facing a strange problem in Python imports. I've written a simple Python module, called test.py. It contains: import wx When I run this code in IDLE, it runs successfully. But

Solution 1:

You should run the command line under your script folder.


For instance,

Your test.py was under the folder: ~/scripts/test.py,

then you should first change to this folder: cd ~/scripts

and run the python command-line: python or python test.py.


The reason is that:

You IDE has already changed to your file folder, since you can run it.

But the command-line was not.


Hope this helps.

Post a Comment for "Python Command Line Import Error"