|
4 | 4 | Environment Variables |
5 | 5 | ********************* |
6 | 6 |
|
| 7 | +.. envvar:: HOME |
| 8 | + |
| 9 | + The user's home directory. On linux, :envvar:`~ <HOME>` is shorthand for :envvar:`HOME`. |
| 10 | + |
7 | 11 | .. envvar:: PATH |
8 | 12 |
|
9 | 13 | The list of directories searched to find executable programs |
10 | 14 |
|
11 | 15 | .. envvar:: PYTHONPATH |
12 | 16 |
|
13 | | - The list of directories that is searched to find Python packages and modules |
| 17 | + The list of directories that is added to Python's standard search list when |
| 18 | + importing packages and modules |
| 19 | + |
| 20 | + |
| 21 | +Setting Environment Variables in Linux |
| 22 | +====================================== |
| 23 | + |
| 24 | +To list the current value of :envvar:`PYTHONPATH`, which may be empty, try:: |
| 25 | + |
| 26 | + echo $PYTHONPATH |
| 27 | + |
| 28 | +The procedure for setting environment variables in depends on what your default |
| 29 | +shell is. BASH seems to be the most common, but CSH is also common. You |
| 30 | +should be able to determine which by running at the command prompt:: |
| 31 | + |
| 32 | + echo $SHELL |
| 33 | + |
| 34 | + |
| 35 | +BASH/KSH |
| 36 | +-------- |
| 37 | + |
| 38 | +To create a new environment variable:: |
| 39 | + |
| 40 | + export PYTHONPATH=~/Python |
| 41 | + |
| 42 | +To prepend to an existing environment variable:: |
| 43 | + |
| 44 | + export PATH=~/bin:${PATH} |
| 45 | + |
| 46 | +The search order may be important to you, do you want `~/bin` to be searched |
| 47 | +first or last? To append to an existing environment variable:: |
| 48 | + |
| 49 | + export PATH=${PATH}:~/bin |
| 50 | + |
| 51 | +To make your changes available in the future, add the commands to your |
| 52 | +`~/.bashrc` file. |
| 53 | + |
| 54 | + |
| 55 | +CSH/TCSH |
| 56 | +-------- |
| 57 | + |
| 58 | +To create a new environment variable:: |
| 59 | + |
| 60 | + setenv PYTHONPATH ~/Python |
| 61 | + |
| 62 | +To prepend to an existing environment variable:: |
| 63 | + |
| 64 | + setenv PATH ~/bin:${PATH} |
14 | 65 |
|
| 66 | +The search order may be important to you, do you want `~/bin` to be searched |
| 67 | +first or last? To append to an existing environment variable:: |
15 | 68 |
|
16 | | -Setting Environment Variables |
17 | | -============================= |
| 69 | + setenv PATH ${PATH}:~/bin |
18 | 70 |
|
19 | | -Linux/OS-X |
20 | | ----------- |
| 71 | +To make your changes available in the future, add the commands to your |
| 72 | +`~/.cshrc` file. |
21 | 73 |
|
22 | 74 |
|
| 75 | +Setting Environment Variables in Windows |
| 76 | +======================================== |
23 | 77 |
|
24 | | -Windows |
25 | | -------- |
| 78 | +Go to the Windows start menu, select `Control Panel`, then select the `System` |
| 79 | +icon, click the `Advanced` tab, and select the `Environment Variables` |
| 80 | +button. You can edit or add to the `user variables`. |
0 commit comments