
Ubuntu 20.04.3 LTS をインストールし、Anaconda3 をインストールしましたが、問題が発生したため Anaconda3 をアンインストールする必要がありました。ルートとして次のコマンドを使用して、ディレクトリから削除しました/home/user
。
# rm -f anaconda3
この後、以下の問題が発生しました:
$ sudo -s
# ls
Command 'ls' is available in the following places
* /bin/ls
* /usr/bin/ls
The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
ls: command not found
私の最後の数行は次のとおりです.bashrc
。
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/thilipkumar/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/thilipkumar/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/thilipkumar/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/thilipkumar/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
echo path
通常のユーザーと rootの出力は次のとおりです。
~$ echo $PATH
/home/thilipkumar/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
~$ sudo -s
/home/thilipkumar# echo $PATH
/root/anaconda3/
次に何をすべきか誰かアドバイスをくれませんか?
答え1
/root/.profile
ルート ユーザーのおよびファイルをチェックして/root/.bashrc
、パスが誤って設定されている場所を修正します。
/etc/skel
また、内の各ファイルを にコピーすることで、これらのファイルをデフォルトに戻すこともできます/root
。
答え2
以下のファイル パスを置き換えてください:
export PATH=$PATH:/usr/bin:/bin
このコマンドは、元のパスを永続的に置き換えます。次に例を示します。
/$ nano .bashrc
Command 'nano' is available in the following places
* /bin/nano
* /usr/bin/nano
The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.
nano: command not found
/$ export PATH=$PATH:/usr/bin:/bin
/$ ls
backups bin boot cdrom dev etc home lib lib32 lib64 libx32 lost+found
madhu media mnt opt proc root run sbin snap srv swapfile sys
tmp usr var