-1

I was trying to add conda and python to the environment variable using SETX Command from CMD but it was failing. I tried setting it using PowerShell and it worked. The path was added successfully but I still can't open Jupyter Notebook from my cmd.

  • _I was trying to add conda and python to the environment variable using SETX Command from CMD_ Why? – AMC Apr 26 '20 at 22:51

1 Answers1

0

Adding Python to the environment path is bad practice, see Anaconda FAQ. If you haven't installed Anaconda with it's default settings, you first need to:

Initialize your shells

conda init --all

After this you should have ../Anaconda3/condabin only in your path (more information via conda init --help).

But before you can run Jupyter, you also need to activate Anaconda:

C:\> conda activate
(base) C:\> jupyter notebook

The activation will add the following folders of the conda base environment to your PATH:

\Anaconda3;
\Anaconda3\Library\mingw-w64\bin;
\Anaconda3\Library\usr\bin;
\Anaconda3\Library\bin;
\Anaconda3\Scripts;
\Anaconda3\bin;

The python.exe resides in Anaconda3, jupyter.exe in Anaconda3\Scripts, so it's not enough to just add the first folder to your Path. And it's especially important to have the libraries on your Path when you want to run C-based packages like numpy.

But the very point behind the conda activate mechanism is that it allows you to configure and run different environments with different versions of python and 3rd party packages that would otherwise conflict, see Managing environmnts.

On top of that you can even install Python from python.org next to your Anaconda distribution, since conda will make sure that they won't interfere.

Peter
  • 10,959
  • 2
  • 30
  • 47
  • Hey, Peter thanks for your response. It worked. Can you please elaborate on why adding conda or python to the environment path is a bad practice? And any reference which may explain what actually happened when I did as you told me? – Qasim Bin Mehmood Apr 25 '20 at 09:15