Neo
Neo

Reputation: 1269

How to update python in cmd prompt using conda?

I have miniconda installed. I updated python by this command:

conda update python

But I got two versions of Python.

If I type in python in Anaconda Prompt, it'll enter python 3.7.1.

If I just open cmd to enter python, I'll still see old version python 3.6.1.

What's the problem? How to make python version the newest whenever I use python in cmd, PyCharm or anywhere else?

Upvotes: 2

Views: 6032

Answers (2)

Neo
Neo

Reputation: 1269

Thank @Mihalis for helping me get the hang of conda environment. But your answer still doesn't fully answer my question: how to use conda environment directly in cmd, instead of opening Anaconda Prompt.

My solution is to first create an environment as @Mihalis said, and activate it. Then use conda env list to find out where my environment is located. Then add it to PATH environment variables (google it for more details). Now if I enter python in cmd, it'll directly call python from the conda environment, which is python 3.7.1.

As for PyCharm, see @Mihalis 's link there to and follow PyCharm's instructions.

Upvotes: 1

Mihalis
Mihalis

Reputation: 356

What's happening is that in each case "python" refers to different installations of python in your system, the one that's on windows when you type python in the cmd and the one that comes with your conda "base" environment.

You should check out how conda environments work.

Once you get familiar with the process it'll be pretty easy to work with your preferred version of python from wherever you need to, especially PyCharm since it comes with built in conda support.

Upvotes: 1

Related Questions