5

I am having trouble adding conda to my environment variables on windows. I installed anaconda 3 though I didn't installed python, so neither pip or pip3 is working in my prompt. I viewed a few post online but I didn't find anything regarding how to add conda to my environment variables.

I tried to create a PYTHONPATH variable which contained every single folder in Anaconda 3 though it didn't worked.

My anaconda prompt isn't working too. :(

so...How do I add conda and pip to my environment variables or path ?

Emiliano Tonizzo
  • 73
  • 2
  • 2
  • 6
  • What do you mean by _My anaconda prompt isn't working too_ ? That might be showing a reinstall is needed. By the way, isn't there a checkbox when installing anaconda to add it to your path ? – BcK Jun 18 '18 at 09:14

2 Answers2

9

You can access to conda and pip directly in their directory :

  • On Windows : %ANACONDA_INSTALL_DIR%\Scripts, you will find conda.exe and pip.exe
  • On Linux : $ANACONDA_INSTALL_DIR/bin, there are conda and pip executable files.

Where $ANACONDA_INSTALL_DIR is the directory of your Anaconda installation.

To add Anaconda to your path, you can add this folder to your PATH. For Linux, you can add this line to yout .bashrc file

export PATH=$ANACONDA_INSTALL_DIR/bin:$PATH

As said @BcK, reinstalling Anaconda and choosing to add Anaconda to your path is also a way to do this. This option makes a backup of your .bashrc file and add the export line.

EDIT

To open a terminal with the conda environment activated on Windows, I usually create a desktop shortcut with the following target :

%windir%\System32\cmd.exe "/K" %ANACONDA_INSTALL_DIR%\Scripts\activate.bat %ANACONDA_INSTALL_DIR%
ractiv
  • 712
  • 8
  • 19
  • I think the "$" is unnecessary for Windows https://stackoverflow.com/questions/45185057/adding-anaconda-to-path-or-not – icypy Dec 13 '22 at 00:43
  • This worked for me make sure you add to the PATH for system environment variables and then when you try to conda activate base in cmd.exe, it'll tell you to cmd init cmd.exe, close that shell and reopoen it. – mLstudent33 Jun 24 '23 at 10:48
0

Thanks guys for helping me out. I solved the problem reinstalling anaconda (several times :[ ), cleaning every log and resetting the path variables via set path= in the windows power shell (since I got some problems reinstalling anaconda adding the folder to PATH[specifically "unable to load menus" or something like that])

Emiliano Tonizzo
  • 73
  • 2
  • 2
  • 6