2

I have installed two versions of python in my computer (python 3.7.4 and 3.9.6). But I can't open one of the version's IDLE. For example if I installed Python 3.7.4 after that 3.9.6 the IDLE of 3.9.6 is not opening and pip(p) also not working. If I tried to open the IDLE through cmd it shows that "** IDLE can't import Tkinter. Your Python may not be configured for Tk. **" .Here I am using python 3.7.4 for 32 bit projects and python 3.9.6 for 64 bit projects. How to fix this problem. Thanks in advance.

  • 1
    Check your environment variables –  Jul 15 '21 at 12:11
  • Check this - https://stackoverflow.com/questions/2812520/dealing-with-multiple-python-versions-and-pip – Amesh Jayaweera Jul 15 '21 at 12:19
  • You run IDLE with specific versions of IDLE either by clicking icons linked to specific python-IDLE combinations (on the start menu or added to desktop or pinned to taskbar) or by entering `py -3.x -m idlelib` commands in Command Prompt or Powershell. `py -3.x -m pip ...` runs `pip` with 3.x. – Terry Jan Reedy Jul 15 '21 at 19:23
  • @Terry Jan Reedy yes i have tried like this only.... Python 3.7.4 is working but python 3.9.6 shows error that ** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** like that... But i have checked Tcl/tk check box during installation. – Muthu Ruban Jul 16 '21 at 02:28
  • Start 3.9 interactively with `py -3.9` or the 3.9 start menu icon. Enter `import tkinter`. What happens? – Terry Jan Reedy Jul 17 '21 at 04:07
  • @Terry Jan Reedy It shows No module named tkinter. I tried to install through pip but pip also not working. But python 3.7.4 is working fine – Muthu Ruban Jul 19 '21 at 02:27
  • On Windows, installing tkinter and IDLE is a choice one makes when installing python with the python.org installer. Installing them is the default, but you might have inadvertently clicked it off. Re-run the 3.9.6 installer, check (X) Install tkinter and IDLE, if you can, and then whatever to proceed. – Terry Jan Reedy Jul 20 '21 at 02:19

1 Answers1

1

You can create multiple virtual env in your system and activate specific according to your need

python3.7.4 -m venv python37-env
python3.9.6 -m venv python39-env

Refer to these document to learn more

https://docs.python.org/3/library/venv.html
prince yadav
  • 219
  • 1
  • 5