Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

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?

like image 569
Blankman Avatar asked Apr 09 '11 02:04

Blankman


People also ask

Where is Python path set in Linux?

Setting Path in Unix or Linux In the csh shell, type the following sentence: PATH “$PATH:/usr/local/bin/python” and press Enter. If you are using the standard flavour of Linux, open up the bash shell and type the following phrase, export PATH=”$PATH:/usr/local/bin/python” and press Enter.

What is Python path in Python?

PYTHONPATH is an environment variable which you can set to add additional directories where python will look for modules and packages. For most installations, you should not set these variables since they are not needed for Python to run. Python knows where to find its standard library.


3 Answers

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

like image 64
Ignacio Vazquez-Abrams Avatar answered Nov 22 '22 06:11

Ignacio Vazquez-Abrams


You can see your python path in python like so:

>> import sys
>> print sys.path
like image 33
Alex Bliskovsky Avatar answered Nov 22 '22 04:11

Alex Bliskovsky


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.

like image 27
jcomeau_ictx Avatar answered Nov 22 '22 06:11

jcomeau_ictx