There are three ways to set environment variables under Linux, one for the current terminal, one for the current user and one for all users:
One: For the current terminal:
In the current terminal, enter:
Export path= $PATH:< your path to join >
However, the method above applies only to the current terminal and is not valid once the current terminal is closed or in another terminal.
Export ndk_root=/home/jiang/soft/android-ndk-r8e #只能在当前终端使用.
Two: For the current User:
There is a. bashrc hidden file in the user's home directory, and you can include the PATH in this file with the following settings:
Gedit ~/.BASHRC
Join:
Export path=< your path to join;: $PATH
If you want to add more than one path, simply:
Export path=< The path you want to join 1>:< the path you want to join 2>.: $PATH
Each path is separated by a colon.
This will take effect every time you log in
This is also the way to add Pythonpath, which is added in. BASHRC
After saving, enter $ source ~/.BASHRC in the terminal to make the environment variable effective immediately
Three: For all users:
Join:
Export path=< The path you want to join;: $PATH
You can do it.
Terminal input: Echo $PATH can view environment variables
Adding Pythonpath methods to Linux and modifying environment variable methods