PATH environment variable delimited in Ubuntu 16.04

微信扫一扫,分享到朋友圈

PATH environment variable delimited in Ubuntu 16.04

I tried installing Anaconda to get many python packages at once but had some issues with python IDLE where it said No package found
so had to manually set the path in ~/.bashrc
.

Once I set the path in ~/.bashrc
the IMPORT ERROR
in python IDLE was solved but I’m unable to use commands on terminal now.

I’m getting this error all the time.

[email protected]:~$ ls
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found
[email protected]:~$ sudo
Command 'sudo' is available in '/usr/bin/sudo'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
sudo: command not found
[email protected]:~$ mkdir aa
Command 'mkdir' is available in '/bin/mkdir'
The command could not be located because '/bin' is not included in the PATH environment variable.
mkdir: command not found

I did export PATH=/usr/bin:/bin
to find out my $PATH
and content of /etc/environment
. It seems both are different.

[email protected]:~$ export PATH=/usr/bin:/bin
[email protected]:~$ echo $PATH
/usr/bin:/bin
[email protected]:~$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

Doesn’t Ubuntu look for $PATH
in /etc/environment
? If yes, what could be the reason my $PATH
is different from /etc/environment
? and please help me fix it! If not, where does Ubuntu look for $PATH
? please help me fix it!

When adding some directory to PATH
it’s good idea not to overwrite previous value, just append desired directory (e.g. $HOME/bin
), in your ~/.bashrc
add at the end line (and remove any previous tampering with PATH
)

export PATH="$PATH:$HOME/bin"

and run:

source ~/.bashrc

(or just open new session of terminal).

微信扫一扫,分享到朋友圈

PATH environment variable delimited in Ubuntu 16.04

The regional gap in AI adoption

上一篇

Amateur Cryptojackers and Apple Macs Emerge as Two Mining Malware Trends for 2018

下一篇

你也可能喜欢

PATH environment variable delimited in Ubuntu 16.04

长按储存图像,分享给朋友