Reputation: 147
I'm having problems running my python script on the cmd line and am running into a module error (1st screenshot)
What I done so far was go into path environments. After that I created a variable, under system variables, that contains the below (2nd screenshot).
I then created a variable called: %PYTHON_HOME% in the variable called Path (also under system variables).
So far I have no problems running the script in Atom but if I were to run this in cmd prompt I can't get it to run. Would anyone have any advice on what else I could do?
Some additional things I had done:
I entered the below in Atom to see my sys.path.
import sys
for i in sys.path:
print(i)
Output
C:\Users\JIMMY-PC\Desktop\PythonNotes
C:\Users\JIMMY-PC\Desktop\Python Notes
C:\Users\JIMMY-PC\AppData\Local\Programs\Python\Python39
C:\WINDOWS\system32
C:\Users\JIMMY-PC\AppData\Local\Programs\Python\Python39\python39.zip
C:\Users\JIMMY-PC\AppData\Local\Programs\Python\Python39\DLLs
C:\Users\JIMMY-PC\AppData\Local\Programs\Python\Python39\lib
C:\Users\JIMMY-PC\AppData\Local\Programs\Python\Python39\lib\site-packages
C:\Users\JIMMY-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\win32
C:\Users\JIMMY-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\win32\lib
C:\Users\JIMMY-PC\AppData\Local\Programs\Python\Python39\lib\site-packages\Pythonwin
UPDATE2:
I tried running my python script in cmd line. Looks like what's appearing in Atom and comparing to cmd line contains different python version. Not sure how to fix this so it looks at python 3.9 instead of 3.7. Any advice would be much appreciated!
Upvotes: 2
Views: 599
Reputation: 147
Found the answer! Will leave my solution here in case other people have this problem....
Because I have different version of python in my computer, that was the reason my computer was having trouble finding the correct module path. I decided to go over to control panel>programs>uninstall a program> all python versions except for the latest version.
As for path environments I created PYTHON_HOME under system variables with the two paths inside (screenshot below). Then I plugged in %PYTHON_HOME% inside Path, restarted my comp and now I can run my python scripts from both my Atom IDE and cmd prompt!
Upvotes: 1