17

This is starting to get aggravating. I'm getting the typical 'python' is not recognized as an internal or external command... message when trying to run python on the command line. This is a common issue, and I've found plenty of posts saying to fix it by adding python folder (C:\Users\ftake\Anaconda3) my Windows path (restarted my PC after that) but nothing worked for me. The problem is that I've already Anaconda 1.8.2 installed on my computer and when trying to run python on CMD an error message occurs saying that python is not recognized as an internal...

I've tried to install pyinstaller (or any other Python packages) using pip, a message occurs too 'pip' is not recognized as an internal or external command... Even though when trying to run (on CMD) the following command to create a virtual environment: virtualenv --python=python3.6.3 <env-name>

I'm using: OS: Windows 10 Pro. Anaconda Version: 1.8.2

Fouzi TAKELAIT
  • 343
  • 1
  • 3
  • 12
  • Version 1.8.2 is really, really out of date. The most recent version is 5.1. I'd suggest you uninstall everything and reinstall the most recent version. – darthbith Apr 02 '18 at 19:54
  • I agree with @darthbith, version 1.8 is really really out of date. You definitely want to uninstall it and reinstall a later version. – Haris Nadeem Apr 04 '18 at 04:25

6 Answers6

21

I just spent 30 minutes on this, so I'll provide a much more detailed answer than the above...

1) Open "My Computer" 2) Right Click "This PC" 3) Select "Properties" Image 1 - My PC

4) Select "Advanced System Settings" Image 2 - Advanced Settings

5) Select "Environment Variables" 6) Under "System Variables", highlight "Path" row 7) Select "Edit" 8) Select "Browse" 9) Navigate to Anaconda Path (Python should be there; check for python.exe at that location)

Image 3 - Adding Path

10) Restart your cmd.exe; everything should work.

15

You probably haven't added it to your environment variables, here how you do it:

  1. Go to "Edit the system environment variables" inside of control panel (you can search for it to using the search thing).

  2. Once you are there make sure you are in the advanced section.

  3. Click "Environment variables". In the section that says "System variables" search for something named "Path".

  4. If path is not there, simply create it by clicking "New" in the part that says system variables.

  5. Once you got that done, select "Path" and click edit, now find the path that you installed Anaconda in (i.e C:\Users\ftake\Anaconda3) and add it to the "Path".

  6. Once you got that done try using the python command again and it should work.

If I was unclear about something, you can follow this as well: https://www.java.com/en/download/help/path.xml

I know it's for java but it works the exact same way for python.

EDIT: Also for pip it's literally the same thing just add \Scripts to the end of the path

Løiten
  • 3,185
  • 4
  • 24
  • 36
Bale
  • 553
  • 1
  • 8
  • 19
4

I had my path setup properly still it didn't seem to work, later I found that I had a partial entry of python files in the C:\Users\User\AppData\Local\Microsoft\WindowsApps and my WindowsApps were in the path to, so when I ran python in it did not work. To check where your python has been installed and has an entry,

Go to Anaconda Prompt and run

where python

it will return you the list of location, add the appropriate one

Praveen G
  • 794
  • 1
  • 13
  • 24
  • 2
    I had `C:\Users\User\AppData\Local\Microsoft\WindowsApps` listed *before* `C:\Users\User\Anaconda3\python.exe`. Moving `C:\Users\User\AppData\Local\Microsoft\WindowsApps` down (to below the Anaconda paths) in the paths configured in the PATH environment variable (see accepted answer for how to do that) made the python executable accessible for me. – Sander Vanden Hautte Feb 18 '21 at 09:26
1

Even i faced the same problem because of python path was not added in environment variable ,follow below steps :

  1. Go to Anaconda prompt type : where python

    say it is C:\ProgramFiles\Anaconda3\python.exe

  2. Open "Advanced system setting" from main menu. In environment variable,edit path and add path : C:\ProgramFiles\Anaconda3

  3. Now in command prompt you see by typing : python --version

& the error "python' is not recognized as an internal or external command on CMD" will also go off.

Shalini Baranwal
  • 2,780
  • 4
  • 24
  • 34
0

once and for all clarification when you get this python or pip is not recognised error in windows command prompt happens often when multiple IDE installations

Go to environmental variables then to system variables where you change or add this

sometimes your anaconda3 path maybe in allusers if you install it as administator so go through the C drive to get that

example C:\Users\All Users\anaconda3

If not try py -m pip install yourpackage

Redz Ch
  • 33
  • 8
0

If you didn't check the Add Anaconda to the Windows PATH during installation, you can do it manually by adding the following paths to your path-variable:

  • C:\<path_to_anaconda_directory>\anaconda3
  • C:\<path_to_anaconda_directory>\anaconda3\Library\mingw-w64\bin
  • C:\<path_to_anaconda_directory>\anaconda3\Library\usr\bin
  • C:\<path_to_anaconda_directory>\anaconda3\Library\bin
  • C:\<path_to_anaconda_directory>\anaconda3\Scripts

The standard path (if you didn't specify anything else in the installation) is C:\Users\<your_user_name>\AppData\Local\Continuum\anaconda3

Løiten
  • 3,185
  • 4
  • 24
  • 36