how to change sys.path?

P

per9000

also se topic named
'problem(s) with import from parent dir: "from ../brave.py import
sir_robin" '

I use this every day now:
sys.path.append("../../py_scripts")

best wishes,
Per
 
Z

Ziga Seilnacht

Michael said:
Is there something like a .pythoninitrc which can run whenever we start
Python
that can load a file with many sys.path.append(), etc?
If not is there some way to modify the Python shell constructor and
destructor?

Thanks in advance:
Michael yanowitz

Yes, there is the user module:
http://docs.python.org/lib/module-user.html
which you have to explicitly import and which will look for
..pythonrc.py file in user's home directory and execute it.

The other option is a sitecustomize module, which should
be put somewhere on the initial search path. It will be
imported automatically during the interpreter initialization.
See:
http://docs.python.org/lib/module-site.html
for details.

Ziga
 
Joined
Aug 31, 2011
Messages
1
Reaction score
0
Go to ~/.bashrc
to the end of the file , insert " export PYTHONPATH=$PYTHONPATH:your path"
then restart the operating system.
Thats all
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top