Alejandro Simkievich
Alejandro Simkievich

Reputation: 3792

anaconda - path environment variable in windows

I'm trying to run Python from the Windows command prompt (windows 10). So the result is the typical one when the path environment variable is not configured

 c:\windows\system32>python
'python' is not recognized as an internal or external command, operable
 program or batch file

However, I'm unsure which directory I should set up in the path variable.

I tried a few variations, and none of them work, including:

c:\users\xxx\anaconda3
c:\users\xxx\anaconda3\Scripts
c:\users\xxx\anaconda3\libs\python34

and none of them works.

Does anyone have experience with this system constellation (windows, anaconda)? Thanks.

Upvotes: 74

Views: 420775

Answers (14)

Blue Clouds
Blue Clouds

Reputation: 8161

enter image description here This is the standard I use.

Python should work with just C:\Users\user_name\Anaconda3\. As you could see a Python.exe there in that path. The challenge to me is usually to make "conda" command work. And this solution fixes this too.

Upvotes: 0

Alejandro Simkievich
Alejandro Simkievich

Reputation: 3792

It turns out I was mistaken.

Here is the solution: In anaconda (as well as in other implementations), set the path environment variable to the directory where 'python.exe' is installed.

As a default, the python.exe file in anaconda is in:

c:\.....\anaconda

After you do that, the Python command works, in my case, yielding the following:

python
Python 3.4.3 |Anaconda 2.2.0. (64|bit)|(default, Nov 7 2015), etc, etc

Upvotes: 48

d.popov
d.popov

Reputation: 4255

What heled me to set that up:

I. Find your conda path

  1. Open 'Anaconda prompt' from start menu
  2. type 'conda init' to auto set up all. That should set everything up!
  3. if that does not work type 'which/where conda'

II. Add your 'path-to\miniconda3\Scripts\conda.exe' folder in windows PATH variable

Upvotes: 0

Arman Fatahi
Arman Fatahi

Reputation: 3005

In Windows 10, you may find it here:

C:\Users\\[USER]\AppData\Local\conda\conda\envs\\[ENVIRONMENT]\python.exe

or

C:\ProgramData\Anaconda3

Upvotes: 3

Bigumangaba
Bigumangaba

Reputation: 51

Try path env var for the system (on Windows)

C:\ ...\Anaconda3\

C:\ ...\Anaconda3\scripts

C:\ ...\Anaconda3\Library\bin

Must solve! It worked for me.

Upvotes: 3

HZ-VUW
HZ-VUW

Reputation: 982

I want to mention that in some win 10 systems, Microsoft pre-installed a python. Thus, in order to invoke the python installed in the anaconda, you should adjust the order of the environment variable to ensure that the anaconda has a higher priority.

V

Upvotes: 3

Sunil Singh
Sunil Singh

Reputation: 303

Provide the Directory/Folder path where python.exe is available in Anaconda folder like

C:\Users\user_name\Anaconda3\

This should must work.

Upvotes: 0

Matt
Matt

Reputation: 41

You can also run conda init as below,

C:\ProgramData\Anaconda3\Scripts\conda init cmd.exe

or

C:\ProgramData\Anaconda3\Scripts\conda init powershell

Note that the execution policy of powershell must be set, e.g. using Set-ExecutionPolicy Unrestricted.

Upvotes: 4

KAMLESH KARKI
KAMLESH KARKI

Reputation: 438

Instead of giving the path following way:

C:\Users\User_name\AppData\Local\Continuum\anaconda3\python.exe

Do this:

C:\Users\User_name\AppData\Local\Continuum\anaconda3\

Upvotes: 29

prusswan
prusswan

Reputation: 7101

To export the exact set of paths used by Anaconda, use the command echo %PATH% in Anaconda Prompt. This is needed to avoid problems with certain libraries such as SSL.

Reference: https://stackoverflow.com/a/54240362/663028

Upvotes: 2

The default location for python.exe should be here: c:\users\xxx\anaconda3 One solution to find where it is, is to open the Anaconda Prompt then execute:

> where python

This will return the absolute path of locations of python eg:

(base) C:\>where python
C:\Users\Chad\Anaconda3\python.exe
C:\ProgramData\Miniconda2\python.exe
C:\dev\Python27\python.exe
C:\dev\Python34\python.exe

Upvotes: 14

Psychotechnopath
Psychotechnopath

Reputation: 2744

You could also just re-install Anaconda, and tick the option add variable to Path.. This will prevent you from making mistakes when editing environment variables. If you make mistakes here, your operating system could start malfunctioning.

Upvotes: 0

Piyush Upadhyay
Piyush Upadhyay

Reputation: 445

C:\Users\\Anaconda3

I just added above path , to my path environment variables and it worked. Now, all we have to do is to move to the .py script location directory, open the cmd with that location and run to see the output.

Upvotes: 4

fivef
fivef

Reputation: 2559

C:\Users\<Username>\AppData\Local\Continuum\anaconda2

For me this was the default installation directory on Windows 7. Found it via Rusy's answer

Upvotes: 3

Related Questions