Reputation: 3749
Firstly this doesn't work:
C:\>python
'python' is not recognized as an internal or external command, operable program or batch file
Then I added .PY, .PYW in pathext so that
C:\echo %pathext%
.COM;,.EXE;.BAT;.CMD;.VBS;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
Then I tried
C:\assco .py
File association not found for extension .py
C:\assco .pyw
File association not found for extension .pyw
Anyone could help? I don't know too much about cmd line so I just followed some steps online like How to execute Python scripts in Windows?
However it just didn't work..
My goal is to run Python in cmd line. Could anyone help?
Upvotes: 1
Views: 1368
Reputation: 114
I agree with merlin2011, except on my system (running Windows 7), Python was installed in c:\Python27 (the version I downloaded was 2.7). So navigating to that directory and typing "python" (without the quotes) invoked the program. Once you add the directory to your path, you will not need to navigate to the Python27 directory. If you installed Python 3, you might have to type "python3" at the c:\ prompt.
Upvotes: 0
Reputation: 9
Right click on My computer->Properties->
In the left hand corner click on advanced system settings
lower right corner enviornment variables
click on path and then click on the 'edit' tab
Now add a semicolon at the end of the string without removing the whole string and add your path where you've installed python and save your settings
In my case the path was C:\Python27
So I added ;C:\Python 27 at the end of all the other paths
Upvotes: 1
Reputation: 20391
Exact steps for adding Python to the path (on Windows 7):
Environment variables...
button;C:\Python27\
to the end (substitute your Python version)Upvotes: 2
Reputation: 75629
In Windows, Python
defaults to installing in a directory called C:\Python2.x
.
python.exe
lives. Note the directory. It might be something like C:\Python2.7\bin
,.set PATH=%PATH%;C:\Python2.x\bin
into your command prompt, using the path from part 2. If you want to set it permanently, follow the directions in Alex Thornton's answer.Upvotes: 3
Reputation: 1087
You have to add Python in your classpath. Like that.
set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
More info here : https://docs.python.org/2/using/windows.html
Upvotes: 0