How do I set the path to Python on Windows?

To set PYTHONPATH on windows to tell Python to search other directories to import modules and packages, go to:

 My Computer & gt; Properties & gt; Advanced System Settings & gt; Environment Variables 

Next, in the system variables, edit the PythonPath variable. At the end of the current PYTHONPATH, add a semicolon followed by the directory you want to add to this path:

< pre class = "EnlighterJSRAW" data-enlighter-language = "python"> C: Python27; C: foo

In this case, add the foo directory to PYTHONPATH.

< ! - ptnonline336-2 ->

Please note that we are adding it, rather than replacing the original PYTHONPATH value. In most cases, you shouldn`t mess with PYTHONPATH. More often than not, you do it wrong, and it will only get you in trouble.

Get Solution for free from DataCamp guru