简体   繁体   中英

How to isolate Anaconda from system python without set the shell path

I want to install Anaconda locally on my home directory ~/.Anaconda3 (Archlinux) and without setting the path in the shell because I like to keep my system python as the default.

So I like to launch the Spyder (or other Anaconda's app) as isolated app from system binaries. I mean when I launch for example .Anaconda3/bin/spyder it launches spyder and this app uses Anaconda's binaries but when I use python ThisScript.py in my shell it uses system python installed from packages (eg /bin/python).

I managed to update the anaconda using .Anaconda3/bin/conda update --all in my shell without setting the Anaconda's binaries path ( .Anaconda/bin/ ) but thsi way run some apps like spyder doesn't work obviously.

You could use virtualenv

1) create a virtual env using the python version you need for anaconda virtualenv -p /usr/bin/pythonX.X ~/my_virtual_env

2) virtualenv ~/my_virtual_env/bin/activate

3) Run anaconda, then deactivate

Currently this zsh function solves the problem using temporarily change the shell path variable. I just need to:

1) anaconda_on

2) which python or python --version or spyder ....

3) anaconda_off

This is neat and solves my problem. But there might be more universal way for this. Any suggestion? There are many cases which is better to isolate anaconda from the system python.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM