简体   繁体   中英

Where is the python path set when I don't have a .bash_profile?

I am running ubuntu, and I don't have a .bash_profile.

So my question is, where exactly is my python path set then?

How can I see what the current python path is, doing:

$PYTHON_PATH

doesn't return anything?

It's set by the site module, and the interpreter executable itself. sys.path contains the current value.

You can see your python path in python like so:

>> import sys
>> print sys.path

you can create a .bash_profile with your favorite editor, and put into it:

export PYTHONPATH=$HOME/lib/python

or whatever, that's one example.

echo $PYTHONPATH /etc/profile and /etc/bashrc are the global setting files bash scans before looking in your home directory at start up. It's also safe to create a .bash_profile if one doesn't exist.

Normally PYTHONPATH is empty anyways.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM