Anaconda paths broken after username change

最后都变了- 提交于 2021-01-05 11:53:42

问题


I just changed my username on Ubuntu (17.10) and my Anaconda packages are messed up. For instance, when I run conda in the terminal, I get the following error:

bash: /home/<new username>/anaconda3/bin/conda: /home/<old username>/anaconda3/bin/python: bad interpreter: No such file or directory

How can I fix this without reinstalling Anaconda3?


回答1:


$ lv home/<new username>/anaconda3/bin/conda will show you the below.

#!/home/<old username>/anaconda3/bin/python
# -*- coding: utf-8 -*-
.
.
.

The interpreter path of this file is old, so you should update the path as below, then conda will work well.

#!/home/<new username>/anaconda3/bin/python
# -*- coding: utf-8 -*-
.
.
.

Similar problems was posted at here, so also check it.




回答2:


First proposition:

Edit the file ~/.bachrc, you may find the export PATH=/home/<new username>/anaconda3/bin/conda:$PATH in the bottom of the file, you will have to change the user name by the current name you use, and then you run source ~/.bachrc

Secound proposition:

If you didn't find the export command on .bachrc file you just have to switch to root and back to your current user name and then run export PATH=/home/<new username>/anaconda3/bin/conda:$PATH



来源:https://stackoverflow.com/questions/49890159/anaconda-paths-broken-after-username-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!