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

    Sep 13, 2010 · In Python 3.4 on windows it worked when I added it to PATH enviroment variable instead of PYTHONPATH. Like if you have installed Python 3.4 in D:\Programming\Python34 then add this at the end of your PATH environment variable;D:\Programming\Python34 Close and reopen command prompt and execute 'python'. It will open the python shell.

  2. How can I access environment variables in Python?

    Feb 5, 2011 · I haven’t set it (PYTHONPATH) before; what I am doing just go with command prompt and type CMD anywhere (since python.exe is in my shell PATH). If I try to access Window ENVIRONMENT variable, it gives mapped value but the problem with Python ENVIRONMENT variable like; PYTHONPATH and PYTHONHOME. –

  3. How to set environment variables in Python? - Stack Overflow

    You should assign string value to environment variable. os.environ["DEBUSSY"] = "1" If you want to read or print the environment variable just use . print os.environ["DEBUSSY"] This changes will be effective only for the current process where it was assigned, it …

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

    Jan 29, 2018 · Click Environment Variables... Select PATH in the System variables section; Click Edit; Add Python's path to the end of the list (the paths are separated by semicolons). For example: C:\Windows;C:\Windows\System32;C:\Python27 For Windows XP: Open System Properties (Type it in the start menu, or use the keyboard shortcut Win+Pause) Switch to the ...

  5. Adding Python to PATH on Windows - Stack Overflow

    I just installed Python 3.3 on Windows 7 using the option "add python to PATH". In PATH variable, the installer automatically added a final backslash: C:\Python33\ and so it did not work on command prompt (i tried closing/opening the prompt several times) I removed the final backslash and then it worked: C:\Python33

  6. python - How to read Windows environment variable value

    Jul 9, 2020 · Try using the following: os.getenv('MyVar') From the documentation:. os.getenv(varname[, value]) Return the value of the environment variable varname if it exists, or value if it doesn’t. value defaults to None.

  7. Adding Python to Windows environmental variables

    Oct 22, 2014 · One quick solution to those who are still struggling with environment variable setup issue. Just Uninstall the existing python version and reinstall it make sure to enable checkbox as "Add Python 3.10 to PATH to the environment variable.

  8. python not recognized in Windows CMD even after adding to PATH

    Jun 12, 2014 · I tried it multiple times with the default installer option, the first one, (Python 3.7.3) with both 'add to environment variable' and 'all users' checked, though the latter was greyed out and couldn't be unchecked. It failed to work for other users except for the user I installed it under until I uninstalled it and chose "Custom Install".

  9. How Should I Set Default Python Version In Windows?

    Feb 23, 2011 · I installed Python 2.6 and Python 3.1 on Windows 7 and set environment variable: path = d:\python2.6. When I run python in cmd , it displays the python version 2.6, which is what I want! But, when I wrote a script in a bat file and ran it, the displayed python version was 3.1.

  10. How to run multiple Python versions on Windows - Stack Overflow

    Aug 29, 2022 · Introduce more details based on the answer given by @Aman. Define different environment variables for different python versions. For example: You have E:\python2\python.exe and E:\python3\python.exe at the same time. Then you can set an environment variable %python2% for E:\python2\python.exe and %python2% for E:\python3\python.exe.