Add to python path in Linux

John Goebel jgoebel at gmail.com
Tue Dec 20 15:01:12 EST 2005


On 20 Dec 2005 08:13:48 -0800, ninhenzo64 <ninhenzo64 at hotmail.com> wrote:

Hey,

> Hi,
>
> I am trying to use wxPython under Linux. Unfortunately, our system
> administrator has gone home for the holidays so I cannot get him to
> install the libraries properly. However, I have unpacked the libraries
> in my home directory, so if there was some way of adding this to the
> path that Python searches libraries for, I think I can get around this
> problem. Does anyone know a way of doing this? Basically I want to be
> able to run this command in python:
>
> >>> import wx
>
> The variable PYTHONPATH doesn't seem to exist. Well, this bash command
> returns nothing:
>
> <bash$> echo $PYTHONPATH
>
> Any ideas anyone?

There are many ways to do append paths so Python can find the package.

You can append the path within the code"

import sys
sys.path.append('/home/fooboy/wxpackage')

Use PYTHONPATH from bash:

export PYTHONHPATH=/home/fooboy/wxpackage
(you can run this just from the command-line or put in into your
$HOME/.bashrc (or $HOME/.bash_profile).

Use $HOME/.pythonrc

see: http://www.johnny-lin.com/cdat_tips/tips_pylang/custom.html

Hope this helps,
John

> Cheers,
>
> Henry
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list