1

I recently installed Python 3.6 for my Windows 10 (64bit) and I want to use pip, but before to install that, I need to execute the following command using the downloaded get-pip.py program:

python get-pip.py

Somehow this doesn't work and I get the following message from Command Line:

'python' is not recognized as an internal or external command, 
operable program or batch file.

(I get the same message when I want to execute some pip commands)

I tried a lot of "solutions" for installing pip, like downloading files from https://bitbucket.org/pygame/pygame/downloads/ but nothing happened, I got the messages...

Could you explain to me why the Command Line doesn't know these commands and how can I install them?

Simplemathic
  • 99
  • 1
  • 3
  • 15
  • I saw solutions like that and I tried it, but it doesn't worked... And I don't have a Python route directory in my C: library – Simplemathic Sep 23 '17 at 13:59
  • 1
    "Environment variable" is the key for you. You need add the directory of python.exe to PATH in environment variables. After you change the PATH, remember to close cmd.exe and open it again to see new environment variables. – Alperen Sep 23 '17 at 14:00
  • Or, you could choose "Add python.exe to Path". [Here](https://www.howtogeek.com/wp-content/uploads/2014/10/Python-8.jpg) is a photo. – Alperen Sep 23 '17 at 14:02
  • I didn't saw this picture when I installed python – Simplemathic Sep 23 '17 at 14:05

3 Answers3

5

No need for admin access:

The reason the error is arising is because python is not in your PATH (meaning it can be called from any directory in the prompt). You can check that its not in the PATH by typing the following:

echo %path%

which will return lost of different directory paths, but not the one to where you have python installed.

To add python to this (and get rid of your error), follow these steps:

  1. Open up control panel.

  2. Go to System. (skip to this step with: Win+Break )

  3. Go to the Advanced tab at the top.

  4. Click on Environment Variables at the bottom.

  5. In the section User variables for ___, add a new one with New.

  6. In this pop-up add the name : path and value : C:\Python34 (or wherever it is installed).

Hope this helps as this is what I did to get python to work from any directory in the command prompt!

Joe Iddon
  • 20,101
  • 7
  • 33
  • 54
  • Is it possible that my python.exe is in this folder? C:\Users\Levente\AppData\Local\Programs\Python\Python36-32 – Simplemathic Sep 23 '17 at 14:16
  • @LeventeVarga Yes it could be, just open that folder in explorer and see if `python.exe` is in it.... – Joe Iddon Sep 23 '17 at 14:17
  • @LeventeVarga You could also open up `cmd` and type `cd` followed by a `space` then your `directory`. Now you are in that `directory`, you can type `python` there to check if it is installed properly there. – Joe Iddon Sep 23 '17 at 14:22
  • Thanks for the answers! All of them was very useful, but this one I think is the best. Thanks again! – Simplemathic Sep 23 '17 at 14:52
1

Open your CMD as administrator and type PATH (prints the output of your system PATH Variable). There have to be a PATH directing to your Python Installation directory. Only with that system Path your cmd knows where python.exe is and search there for python. Normally the Python Installation Setup asks if you want to set a Python Environment PATH Variable. Maybe run the setup again and watch out for that option. And I think there was a checkbox to automatic install pip for python.

If you want to set the Path Environment Variable use this:

https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10

If you want to manually install pip with GET-PIP you have to download get-pip.py first and then run it with python. Download get-pip from here.

https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py

MNCODE
  • 159
  • 3
  • 16
  • I ran get-pip.py but it doesn't worked for me – Simplemathic Sep 23 '17 at 14:08
  • Yes because Python is not set in the environment path. If you jsut type python the system don't know where python.exe is. It searches in the directory you are and in the directories in your PATH Variable for python.exe. You have to set the environment Variable or run: {your Python installation directory}\python pip-get.py And you also have to be in the directory where your pip-get.py is. use cd {directory-name} to go to this directory – MNCODE Sep 23 '17 at 14:18
1

Could you explain to me why the Command Line doesn't know these commands and how can I install them?

This happens when Python executables are not added to PATH. @xyres provided a nice link on how to do this.

I want to use pip, but before to install that, I need to execute the following command using the downloaded get-pip.py program:

pip should be bundled with the official Python installer, so there should be no need to get it from other sources

szuro
  • 71
  • 1
  • 7
  • That't interesting cos I don't have pip – Simplemathic Sep 23 '17 at 14:10
  • Although it is bundled, it's an optional feature and requires selecting during installation. It seems that the newest installer (3.6.2) just installs it without prompting. – szuro Sep 23 '17 at 17:09