I am using Python 3.2 on Windows 7. When I open the Python shell, how can I know what the current directory is? How can I change it to another directory (where my modules are)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
osmodule.But if it’s about finding other modules: You can set an environment variable called
PYTHONPATH, under Linux would be likeThen, 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
Under Windows:
(taken from http://docs.python.org/using/windows.html)
edit 2
… and even better: use
virtualenvandvirtualenv_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.http://virtualenvwrapper.readthedocs.org/en/latest/command_ref.html