8

I'm wanting to learn machine learning, but it requires that I use 'pip.' I'm still very new to a lot of this stuff. I've installed Python 3.4 64-bit and get-py.py.

When I run pip install sklearn I get 'pip' is not recognized as an internal or external command, operable program or batch file.

Here's a screenshot of my environmental variable PATH

https://gyazo.com/c7ec926401878845d5c4f9a556cf00ee

Any help would be greatly appreciated. I have checked out other posts where people had similar issues, but I tried various things and nothing worked.

Jason Procka
  • 305
  • 1
  • 6
  • 13

9 Answers9

11

I downloaded Python 3.6 and the pip was installed on my system. I found pip at below location:

C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts

Also, before I found pip I used below command on my command prompt to install pyperclip:

python -m pip install pyperclip
K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43
AkshayKrish
  • 167
  • 1
  • 7
10

Easiest solution is to just download a platform like Anaconda for example. It is Python with many libraries (sklearn, pandas, numpy, ...) and also with pip, all in a user-friendly Windows installer package, that takes care of everything for you.

https://www.continuum.io/downloads

If you really want to do it yourself, then

  1. download get-pip.py (https://bootstrap.pypa.io/get-pip.py)

  2. make sure you have Python installed and in your PATH, for example by running python --version in command prompt

  3. Navigate to the directory, where you downloaded get-pip.py (in command prompt using the command cd).

  4. Run the command python get-pip.py from a command prompt with admin privileges (possibly not needed, but just to make sure).

  5. This should be all. Close your command prompt, open it again and run pip --version to test it. If it doesn't work, then search your computer for a file named pip.exe (most likely in your Python directory) and if you find it, add its path to your PATH variable (given the screenshot, I assume you know how to do this).

Joe Samanek
  • 1,644
  • 12
  • 16
  • Nicely explained, but instead of just adding pip to PATH, it's better to add the entire python-directory (which should include pip in the later versions) to PATH. – Abdel Aleem Aug 14 '20 at 09:06
3

For anyone that might have installed Python using the MSI installer, and ticked the box to include pip, but still gets the error 'pip' is not recognized as an internal or external command, operable program or batch file:

It looks like that the pip executable is installed in the \Scripts subdirectory of the Python installation, but that directory does not get automatically added to PATH.

For me, since I had installed Python 2.7, the directory was C:\Python27\Scripts. After adding this path to the PATH environment variable, and open a new CMD window, pip was available as a command.

Odysseas
  • 995
  • 9
  • 21
2

I've made a workaround that will help you, copy the batch script below and modify it as specified:

@"PATH to python.exe" "PATH to pip.exe" %*

For example like this:

@"C:\programming\bin\python374\python.exe" "C:\programming\bin\python374\Scripts\pip.exe" %*

Save this file as pip.bat on Desktop and then move it to C:\Windows\system32.

enter image description here

1

I'm late now, but just add python to your environment variables.

It´s explained in this short video, how to set up python to your environment variables: https://www.youtube.com/watch?v=Y2q_b4ugPWk

after that pip should work on your cmd prompt, without cd to "C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts"

akay
  • 91
  • 1
  • 10
KhoiABC123
  • 26
  • 1
  • 3
  • 2
    while this probably answers the question, please consider the fact that linked content tends to disappear. So please have your answer reflect the gist of the content you link to. – warped Aug 31 '19 at 18:47
1

For Python 3.7 or higher at least (as today is October 4th 2019) in the installation window you need to check the box "add to PATH" when you first install Python.

DaWiseguy
  • 786
  • 7
  • 16
1

This is late but in case anyone runs across this issue, pip installed for me as "pip3". Once I used pip3 as my command and not pip, it worked fine. Threw me for quite a loop since I've been using Python for years.

1

PIP Install and Upgrade

Ensure you are accessing the right location while accessing pip as shown in my link above. Starting Python 3.4, it is included by default with the Python binary installers.

Environment Variable It is also a good idea to update the environment variable if the path is not accessible by default, once the installation is complete.

0

If it is specifically pip you want you could install python again making sure to tick the install pip box which it sounds like you failed to upon initial installation.

Joss Bird
  • 295
  • 1
  • 4
  • 19
  • I've installed Python over and over again 5 times already. Pip was selected every time. I'm now attempting to install Anaconda. – Jason Procka May 28 '17 at 21:41
  • Okay sorry. python doesn't appear in your path. try adding C:\Python34 to your path assuming it was a default installation. – Joss Bird May 28 '17 at 21:44
  • The installation of Anaconda was successful and Pip now works. However, running .py files in atom using atom-runner I get an error: https://gyazo.com/4ee871cfe9deb3a391bceb47555b0c9d – Jason Procka May 28 '17 at 22:58