carebear
carebear

Reputation: 771

Problems installing Python 27 on Windows 7 - cannot add Python to PYTHON PATH

I installed Python 2.7.3 on my Windows 7 computer using the binary, the first link. After installing it, IDLE works but nothing else recognizes Python. For example, typing python at the command prompt returns the message "'Python is not recognized as an internal or external command, operable program or bath file."

Following this post, I made sure that python 2.7 was in the PYTHONPATH environment variable. However, that didn't help.

What should I do?

Upvotes: 2

Views: 2534

Answers (4)

mohu
mohu

Reputation: 89

You can install for single user rather than choosing the option of "Install for all users". I was facing the same issue, but when I tried installing just for myself, I was able to install successfully.

Upvotes: 0

anthonydb
anthonydb

Reputation: 314

Here are your steps:

Right-click Computer and select Properties.

In the dialog box, select Advanced System Settings.

In the next dialog, select Environment Variables. In the User Variables section, edit the PATH statement to include this:

C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;

Now, you can open a command prompt (Start Menu|Accessories or Start Menu|Run|cmd) and type:

C:\> python

That will load the Python interpreter!

Upvotes: 0

pyjavo
pyjavo

Reputation: 1613

Like Vladimir commented, for setting up python in windows, you need to add the directory where your python.exe is located (for example C:\Python27) to PATH

You can confirm if python is in your environment variables by looking at the output of echo %path%

Keep in mind that after editing the PATH variable using the control panel, you have to open a new terminal, as the setting will NOT be updated in existing terminals.

Another possibility is that you added the wrong path to the PATH variable. Verify it.

The bottom line is, if the directory of your python.exe is really in PATH, then running python will really work.

Upvotes: 0

Vladimir
Vladimir

Reputation: 10513

PYTHONPATH system variable is used by Python itself to find directories with installed packages.

PATH system variable is used by OS (particularly Windows) to find executables which can open certain files like *.py scripts.

So, you need to add directory with python.exe (for example C:\Python27) to PATH system (or user) variable and not to PYTHONPATH. It can be done the same way as described in the link you've found in the same tool window.

For example on my machine PATH system variable is set to C:\Python27;C:\MinGW\bin;...

Upvotes: 2

Related Questions