How to set Python Path on Windows Vista?

Question:

I am installing active python, django. I don’t know how to set the python path in vista environment system.

First of all will it work in vista?

Asked By: jbcedge

||

Answers:

Perhaps this helps: It’s a Guide to installing Python in Windows Vista.

Answered By: schnaader

Remember that in addition to setting PYTHONPATH in your system environment, you’ll also want to assign DJANGO_SETTINGS_MODULE.

Answered By: Jeff Bauer

Temporary Change

To change the python path temporarily (i.e., for one interactive session), just append to sys.path like this:

>>> import sys
>>> sys.path
['',
 'C:\Program Files\PyScripter\Lib\rpyc.zip',
 'C:\Windows\system32\python27.zip',
 'C:\Python27\DLLs',
 'C:\Python27\lib',
 'C:\Python27\lib\plat-win',
 'C:\Python27\lib\lib-tk',
 'C:\Python27',
 'C:\Python27\lib\site-packages']
>>> sys.path.append(directory_to_be_added)

Permanent (More or Less) Change

Go to Computer -> System Properties (Either by the big button near the title bar or in the context-menu by right-clicking) -> Advanced Settings (in the right-hand nav bar) -> Environment Variables. In the System Variables, either add a variable called PYTHONPATH (if it’s not already there, i.e., if you haven’t done this before) or edit the existing variable.

You should enter the directories normally (take care to use backslashes, not the normal ones) separated by a semicolon (;) w/o a space. Be careful not to end with a semicolon.

The directories that you just entered now will be added to sys.path whenever you open a interpreter, they won’t replace it. Also, the changes will take place only after you’ve restarted the interpreter.


Source: http://greeennotebook.com/2010/06/how-to-change-pythonpath-in-windows-and-ubuntu/

Answered By: Yatharth Agarwal
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.