About 418,000 results
Open links in new tab
  1. python - How to add to the PYTHONPATH in Windows, so it finds …

    Sep 13, 2010 · Before this, do echo %PYTHONPATH% if this gives you a path go on, otherwise, do e.g. set PYTHONPATH=.;C:\My_python_lib If you don't, windows will expand %PYTHONPATH% to empty string as expected, it will keep it as %PYTHONPATH% in the PYTHONPATH and everything will break! Sounds crazy but thats how win7 cmd works...

  2. python - How do you correctly set the PYTHONPATH variable on …

    Feb 29, 2012 · PYTHONPATH = If this variable exists in your environment, Python will add it to the normal search path for modules when you use any import statement; you normally do not modify this as well behaved Python scripts will install themselves in the site-packages directory, and Python searches this by default. PATH = this is the global file system ...

  3. In Python script, how do I set PYTHONPATH? - Stack Overflow

    Jun 24, 2010 · It has been many years since this answer was posted, but I still want to add that if you want to make sure that Python checks the new directory before all of the others when importing, you should put the new directory first in the list, as in sys.path.insert(0, '/path/to/whatever').

  4. How do I add Python to the Windows PATH? - Super User

    Jan 29, 2018 · The interesting thing here is where Python actually gets installed. Earlier versions would go directly to a folder off the root (C:/Python27) but now it seems the default web install places it in the user's AppData/Local here: C:\Users\{yourUserNameGoesHere}\AppData\Local\Programs\Python\Python36 I didn't check the box as Python was installing, but after adding this to the end of the path as ...

  5. Adding Python to PATH on Windows - Stack Overflow

    The following program will add the python executable path and the subdir Scripts (which is where e.g. pip and easy_install are installed) to your environment. It finds the path to the python executable from the registry key binding the .py extension. It will remove old python paths in your environment. Works with XP (and probably Vista) as well.

  6. Python - add PYTHONPATH during command line module run

    I tried python -c"import sys;sys.path.append('/my/dir')" and then python myscript.py mycommand, but it obviously doesn't share the path from the first interpreter session with the next. Ah, just saw your next comment, trying now... Didn't work on WinXP.

  7. python - What exactly should be set in PYTHONPATH ... - Stack …

    For most installations, you should not set these variables since they are not needed for Python to run. Python knows where to find its standard library. The only reason to set PYTHONPATH is to maintain directories of custom Python libraries that you do not want to install in the global default location (i.e., the site-packages directory).

  8. python - How to set the current working directory? - Stack Overflow

    Oct 25, 2017 · @jwodder - I agree with you. OTOH, there are at least 24 people for which this was useful. Perhaps it was the fact that he covered ítems in the comments of the accepted answer: 1) format of explicit paths, 2) how to get examples of such (with getcwd).... remarkable.

  9. python - Changing PYTHONPATH in shell - Stack Overflow

    Mar 10, 2013 · To see that PYTHONPATH really gets set and works within Python, instead of running the script like above with python script_name, use python -c 'import os; print os.getenv("PYTHONPATH")'. It should display the PYTHONPATH you just set. Likewise, printing sys.path in Python interpreter should output the path in PYTHONPATH as one of the entries.

  10. How to globally modify the default PYTHONPATH (sys.path)?

    I'd like to summarize my findings about python's path modification. There are two ways to do it..pth file; PYTHONPATH; Any.pth file which is found on the default path (see bellow) will get its content included into sys.path. Format of said .pth file is simple: one (folder) path per line.

Refresh