问题
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