0

I have 2 Python versions installed on my PC: 3.7 and 2.7 Only python 3.7 path defined in Windows PATH variable. When I run a script from command line using python command:

python my_script.py

It works. BUT, when I run this script without typing python command, I get an error:

Traceback (most recent call last):
  File "C:\.......my_script.py", line 3, in <module>
    from tkinter import *
ImportError: No module named tkinter

I installed tkinter only for python 3, so I assume it tried to run my_script.py using python 2

How can I define in Windows to run python scripts using version 3 instead of 2 without typing command python? (adding any sort of #!...python3 in the beginning of the script did not helped)

Thank you for your help

Halona
  • 1,475
  • 1
  • 15
  • 26
  • 1
    you should try [https://stackoverflow.com/questions/11472843/set-up-python-on-windows-to-not-type-python-in-cmd](https://stackoverflow.com/questions/11472843/set-up-python-on-windows-to-not-type-python-in-cmd) and specify the path of your 3.7 python virsion – seif Mar 22 '21 at 08:15
  • @seif, thank you this solved my issue – Halona Mar 22 '21 at 08:51

0 Answers0