Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between the python in Anaconda and original one

I'm a windows user and I've already installed the python (which is version 3.6) on my computer. Then I downloaded the Anaconda and when I open the Anaconda prompt to run python, it gives python version3.7

However, if I directly use the cmd to run python, it still appeared to be version 3.6 . It seems there are 2 versions in my computer. As I can use some libraries in the anaconda prompt python but cannot use them in my original python. One thing I'm not very happy with is that the anaconda prompt runs much slower than cmd in my computer.

So my question is: will there be any conflict between these two pythons and their libraries? If I want to use the libraries and packages embedded in anaconda, does it necessarily mean I can only use the anaconda prompt (but cannot use cmd in windows) to run my python file from now on?

like image 381
Yuchern Avatar asked Dec 21 '25 03:12

Yuchern


1 Answers

The system Python and Anaconda Python interpreters should not come into conflict. The motivation for this lies with virtual environmnets. If you want to use the modules in your anaconda python, you don't necessarily need to execute from the anaconda prompt. To do this (as in how I would do this), you will need to determine the filepath of your anaconda python instance. You can set that path as your default by modifying your $PATH (see related post) environment variable. If you don't want to set it as your default, but just use for some scripts, you can always call the C:\path\to\anaconda\env\python.exe to execute whatever script. If you do this, might be worth setting as an environment variable of its own to make calling easier (something like $CONDA_PYTHON). There are other ways to execute such as setting the shebang line in the script directly, but this isn't supported on all versions of windows and python. More details on that can be found here. Hope this helps.

like image 99
AdamMurderface Avatar answered Dec 22 '25 18:12

AdamMurderface



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!