Modifying the PATH environment variable CentOS method

Today, at the time of system installation pip3 given as follows:

The script wheel is installed in '/usr/bin/python3.6.4/bin' which is not on PATH.
复制代码

So the purpose is to get /usr/bin/python3.6.4/bin directory to the PATH.
Found three methods are summarized as follows after the Internet search circle.

method 1

PATH=$PATH:/usr/bin/python3.6.4/bin

Using this method, only the current session (current terminal window) is valid, that is to say after the log out or log off the system each time, the PATH become invalid

Method 2

vi / etc / profile

Add in place PATH = $ PATH: /usr/bin/python3.6.4/bin (Note: = that is equal on both sides can not have any spaces)
This method is best, unless you are forced to manually modify the value of PATH, otherwise it would not It will be changed

Method 3.

vi ~ / .bash_profile

Modify the PATH line, added to it to //usr/bin/python3.6.4/bin
This method is only for the current user function

Note: want to change the PATH, you must re-login to take effect, the following method can simplify the work:
If you modify the / etc / profile, then perform value source profile or execute command ./profile,PATH point after the end of the editing will take effect immediately.
The principle of this method is to perform another / etc / profile shell script, note that if sh / etc / profile is not enough, because sh is executed in the sub-shell process, even if the PATH does not change the response to the current environment , but the source is executed in the current shell process, so we can see the change in the PATH.


Link: https: //www.jianshu.com/p/29641331ad3a


Reproduced in: https: //juejin.im/post/5d01f3216fb9a07ec07fb9f7

Guess you like

Origin blog.csdn.net/weixin_33700350/article/details/93178259