Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PYTHONPATH showing empty in ubuntu 13.04

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

like image 244
Gaurav Jain Avatar asked Jan 07 '14 07:01

Gaurav Jain


People also ask

How do I permanently set Pythonpath?

System > Control Panel > Advanced system settings > Advanced (tap) Environment Variables > System variables > (if you don't see PYTHONPATH in Variable column) (click) New > Variable name: PYTHONPATH > Variable value: Please, write the directory in the Variable value.


2 Answers

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

like image 118
Francesco Montesano Avatar answered Nov 16 '22 09:11

Francesco Montesano


If you want Python to have some extra set of paths in it's sys.path in every Python session apart from the default ones (site-packages etc) you add it to the $PYTHONPATH environment (local or system) variable.

Most probably you don't need it right now, leave it as it is.

Plus you'll know when you really need it populate it.

If you use site.addsitedir("path") in almost every Python path then you can add that "path" to $PYTHONPATH.

Check virtualenv.

like image 35
Bleeding Fingers Avatar answered Nov 16 '22 10:11

Bleeding Fingers