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.
精彩评论