modify python search path
Site-specific configuration hook
http://stackoverflow.com/questions/8248397/how-to-know-change-current-directory-in-python-shell You can use the os module.
edit 1
edit 2
And even better: use virtualenv and virtualenv_wrapper, this will allow you to create a development environment where you can add module paths as you like (add2virtualenv) without polluting your installation or "normal" working environment.
>>> import os >>> os.getcwd() '/home/user' >>> os.chdir("/tmp/") >>> os.getcwd() '/tmp'
But if it's about finding other modules: You can set an environment variable called PYTHONPATH, under Linux would be like
export PYTHONPATH=/path/to/my/library:$PYTHONPATH
Then, the interpreter searches also at this place for imported modules. I guess the name would be the same under Windows, but don't know how to change. edit 1
Under Windows:
set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
edit 2
And even better: use virtualenv and virtualenv_wrapper, this will allow you to create a development environment where you can add module paths as you like (add2virtualenv) without polluting your installation or "normal" working environment.
Comments