Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch between Python paths?

I recently downloaded anaconda, which changed my default python path to

 $ which python
 /anaconda3/bin/python

However, I'd like to switch between that and the default,

/usr/bin/python

Whats the best way to go about doing that?

like image 515
Andrew Harper Avatar asked Oct 17 '25 09:10

Andrew Harper


1 Answers

If you installed the latest version (2018.12) and let it modify your .bashrc file automatically, then you just need to deactivate conda to use the system python. Then use conda activate to switch back into a conda environment.

[builder@3abd754f9aeb ~]$ which python
~/anaconda2/bin/python
[builder@3abd754f9aeb ~]$ conda deactivate
[builder@3abd754f9aeb ~]$ which python
/usr/bin/python
[builder@3abd754f9aeb ~]$ conda activate
(base) [builder@3abd754f9aeb ~]$ which python
~/anaconda2/bin/python
(base) [builder@3abd754f9aeb ~]$
like image 195
William D. Irons Avatar answered Oct 20 '25 06:10

William D. Irons



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!