Regrettably, I followed a tutorial and set PYTHONPATH to qgis\apps\python. After doing so, typing python -V in the OSGeo4W Shell gives Python 2.7.14. Previously, the result was Python 3.7.0, which is the version I want. I deleted the PYTHONPATH variable and rebooted my pc, but version 2.7 remains the default in the shell. How can I restore Python 3 to the default again.

  • You can check your PATH environment variable, the python version you are getting now is the first one your PATH can find, in this case 2.7
    – Dror Bogin
    Dec 28, 2021 at 7:02
  • It would be nice if it were that simple, but that's not it. The python version on my system is 3.7.3, and that takes first place. I don't use version 2 since its end of life. The python I am accessing is associated with qgis, which has both version 2 and 3, and runs from the OSGeo4W Shell.
    – Jillinger
    Dec 28, 2021 at 12:20
  • I just found the solution.
    – Jillinger
    Dec 28, 2021 at 12:35

1 Answer 1


I found the answer in this post. I just needed to run py3_env. Now python -V returns Python 3.7.0

Not the answer you're looking for? Browse other questions tagged or ask your own question.