程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Several ways for Linux to modify $path environment variables by adding python3 as a column

編輯:Python

see PATH:echo $PATH
To add python3 Column
Modify method 1 :
 export PATH=$PATH:$HOME/bin:
 export PATH=$PATH:$HOME/bin:/usr/local/python3/bin
// After configuration, you can use echo $PATH View configuration results .
Effective method : Immediate effect
Term of validity : A temporary change , Only valid in the current terminal window , When the current window is closed, it will be restored path To configure
Scope of authority : Only for current users


Modify method 2 :
By modifying the .bashrc file :
vim ~/.bashrc
// Add... To the last line :
 export PATH=$PATH:$HOME/bin:
 export PATH=$PATH:$HOME/bin:/usr/local/python3/bin
Effective method :( There are two )
1、 Close the current terminal window , Reopening a new terminal window will take effect
2、 Input “source ~/.bashrc” command , Immediate effect
Term of validity : Permanent validity
Scope of authority : Only for current users

Modify method 3 :
By modifying the profile file :
vim /etc/profile
/export PATH // Find settings PATH The line of , add to
 export PATH=$PATH:$HOME/bin:
 export PATH=$PATH:$HOME/bin:/usr/local/python3/bin
must : System restart
Term of validity : Permanent validity
Scope of authority : For all users

Modify method 4 :
By modifying the environment file :
vim /etc/environment
stay PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:" Add “/usr/local/python3/bin”
must : System restart
Scope of authority : Permanent validity


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved