PYTHONPATH showing empty in ubuntu 13.04

Gaurav Jain picture Gaurav Jain · Jan 7, 2014 · Viewed 24.8k times · Source

when i do echo $PYTHONPATH it returns nothing..empty line.

so what does that mean. Im using python and it's working fine ..so whats the use of pythonpath and what should be the value of this in ubuntu 13.04

/usr/bin/

or

/usr/lib/

..or something else

and in windows we have python27/source directory where i could put external sources/drivers , where(or equivalent) it is in ubuntu.

when I do user@user$ dpkg -L python2.7 it shows

/.
/usr
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/lib2to3
/usr/lib/python2.7/lib2to3/fixer_util.py
....
/usr/lib/python2.7/lib2to3/Grammar.txt
/usr/share
/usr/share/doc
/usr/share/doc/python2.7
/usr/share/doc/python2.7/NEWS.gz
/usr/share/doc/python2.7/README.Debian
/usr/share/doc/python2.7/ACKS.gz
/usr/share/doc/python2.7/README.gz
/usr/share/doc/python2.7/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/python2.7
/usr/share/applications
/usr/share/applications/python2.7.desktop
/usr/share/menu
/usr/share/menu/python2.7
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/2to3-2.7.1.gz
/usr/share/man/man1/pdb2.7.1.gz
/usr/share/man/man1/pygettext2.7.1.gz
/usr/share/man/man1/pydoc2.7.1.gz
/usr/share/pixmaps
/usr/share/pixmaps/python2.7.xpm
/usr/bin
/usr/bin/2to3-2.7
/usr/bin/pygettext2.7
/usr/bin/pydoc2.7
/usr/share/doc/python2.7/changelog.gz
/usr/share/doc/python2.7/changelog.Debian.gz
/usr/bin/pdb2.7

I've downloaded chrome driver from this site and put in given directory/usr/bin..but it's not working .where should i put this? https://code.google.com/p/selenium/wiki/ChromeDriver

Answer

Francesco Montesano picture Francesco Montesano · Jan 7, 2014

The variable PYTHONPATH that you echo in the terminal is added to the other paths of python. So if you don't have any particular path set in your .profile or .bashrc file (or locally), the variable will be empty.

To see the path that python uses do in a python shell

import sys
print(sys.path)

Or as @mgilson suggestes, you can run from terminal

python -c 'import sys; print(sys.path)'

A note: If you decide to install by hand a package using python setup.py install --user you don't need to add $HOME/.local/lib/pythonX.X/site-packages to PYTHONPATH, as it is already in sys.path