[python] How to make conda take effect again after anaconda changes the directory

Assuming that annaconda was originally installed in /home/anaconda, now due to the tight storage of the home directory, move anaconda to /work/anaconda

mv /home/anaconda /work/anaconda

At this time, if you open the shell directly, you will find that you will not automatically enter the base environment. If you enter conda, you will be prompted that the bin/conda file or directory does not exist.
In order to make conda take effect again, there are two simple methods as follows:

It is strongly recommended to use soft links

! ! ! ! Note that if many virtual environments have been created before, then use only soft links. Do not use conda init below

1. Soft link

ln -s /home/anaconda3 /work/anaconda3

2. conda heat

cd /work/anaconda3/bin
conda init

conda will automatically update the environment information in all files.
insert image description here

If you have created a virtual environment before, you may need to manually modify the addresses of many files in bin/ in the virtual environment

Guess you like

Origin blog.csdn.net/weixin_43693967/article/details/129425314