How to set your python path on Windows?


To set the PYTHONPATH on windows to point Python to look in other directories for module and package imports, go to:

My Computer > Properties > Advanced System Settings > Environment Variables

Then under system variables edit the PythonPath variable. At the end of the current PYTHONPATH, add a semicolon and then the directory you want to add to this path:

C:\Python27;C:\foo

In this case, are adding the foo directory to the PYTHONPATH. Note that we are appending it and not replacing the PYTHONPATH's original value. In most cases, you shouldn't mess with PYTHONPATH. More often than not, you are doing it wrong and it will only bring you trouble.

Updated on: 30-Sep-2019

739 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements