About 613,000 results
Open links in new tab
  1. How do I find out my PYTHONPATH using Python? - Stack Overflow

    Sep 28, 2009 · I find it easier to use the following, since it makes it clear if the empty string ('') is in the path: python -c "import sys, pprint; pprint.pprint(sys.path)" ( And I found this answer more helpful, too; the title of the question mislead me into thinking it was about the actual path python was using, rather than the contents of the PYTHONPATH environment variable.)

  2. How can I find where Python is installed on Windows?

    Mar 15, 2009 · It is compatible with all available versions of python. First, check if the launcher is available: py starts the latest installed version of Python. To see all Python versions available on your system and their path: py -0p or. py --list-paths For a specific Python version path—especially useful with multiple python installations:

  3. python - How to get the PYTHONPATH in shell? - Stack Overflow

    Apr 29, 2013 · @variable No, the paths in PYTHONPATH is added to the paths in sys.path when the Python interpreter starts. In other words, sys.path will include all the paths in PYTHONPATH, but also additional paths, like the path to the Python standard library …

  4. How do I check if a directory exists in Python? - Stack Overflow

    We can check with 2 built in functions . os.path.isdir("directory") It will give boolean true the specified directory is available. os.path.exists("directoryorfile") It will give boolead true if specified directory or file is available. To check whether the path is directory; os.path.isdir("directorypath") will give boolean true if the path is ...

  5. Find full path of the Python interpreter (Python executable)?

    Apr 7, 2010 · There's no deterministic relation between what the external shell considers to be python (i.e., the absolute filename of the python command in the current ${PATH}) and the command the active Python interpreter is actually running under.

  6. How do I check which version of Python is running my script?

    To check from the command-line, in one single command, but include major, minor, micro version, releaselevel and serial, then invoke the same Python interpreter (i.e. same path) as you're using for your script:

  7. python - Find the current directory and file's directory - Stack …

    Please note, that Path.cwd(), Path.resolve() and other Path methods return path objects (PosixPath in my case), not strings. In Python 3.4 and 3.5 that caused some pain, because open built-in function could only work with string or bytes objects, and did not support Path objects, so you had to convert Path objects to strings or use the Path ...

  8. python - How to add to the PYTHONPATH in Windows, so it finds …

    Sep 13, 2010 · The question isn't about the PATH that DOS uses to find commands, but the Python path, i.e. sys.path in Python. In most operating systems, Python just uses the system environment variable PYTHONPATH, but Windows seems to be 'special'. –

  9. How do I know python path on linux ubuntu? - Stack Overflow

    Dec 24, 2020 · gives path to python. as: which python3 gives python3 path. Share. Improve this answer. Follow ...

  10. python - How do I check whether a file exists without exceptions ...

    Use os.access(path, mode): This will check whether you have access to the file. It will check for permissions. Based on the os.py documentation, typing in os.F_OK, it will check the existence of the path. However, using this will create a security hole, as someone can attack your file using the time between checking the permissions and opening ...

Refresh