Several ways for Linux to modify the $PATH environment variable, including adding python3 as a column

Check PATH: echo $PATH
to add python3 as a column
Modify method 1:
 export PATH=$PATH:$HOME/bin:
 export PATH=$PATH:$HOME/bin:/usr/local/python3/bin
//After configuration You can check the configuration result by echo $PATH.
Effective method: Effective immediately
Valid period: Temporary change, only valid in the current terminal window, the original path configuration will be restored after the current window is closed
Permission scope: Only for the current user


Modification method 2:
By modifying the .bashrc file:
vim ~/.bashrc
//Add in the last line:
 export PATH=$PATH:$HOME/bin:
 export PATH=$PATH:$HOME/bin:/usr/local/python3 /bin
take effect method: (there are the following two)
1. Close the current terminal window and reopen a new terminal window to take effect
2. Enter the "source ~/.bashrc" command and it will take
effect immediately
. for current user

Modification method 3:
By modifying the profile file:
vim /etc/profile
/export PATH //Find the line that sets PATH, add
 export PATH=$PATH:$HOME/bin:
 export PATH=$PATH:$HOME/bin:/usr /local/python3/bin
must: restart the system
Expiry date: permanent
Permission scope: for all users

Modification method 4:
By modifying the environment file:
vim /etc/environment
add "/usr/local" in PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:" /python3/bin"
must: system restart
Permission scope: permanently valid

Guess you like

Origin blog.csdn.net/UUUUUnnn/article/details/125384079