简体   繁体   中英

How to pip install tkinter

I use pip install python-tk but have an error ERROR: Could not find a version that satisfies the requirement python-tk (from versions: none) ERROR: No matching distribution found for python-tk

Tkinter isn't distributed through pip; if it didn't come pre-packaged with Python, you have to get it from elsewhere:

  • Ubuntu
sudo apt-get install python3-tk 
  • Fedora
sudo dnf install python3-tkinter
  • MacOS
brew install python-tk

It seems like you are trying to install tkinter but using a package name that is not supported. Try: pip install tk

Firstly Make sure Python and pip is preinstalled on your system. Type the following commands in command prompt to check is python and pip is installed on your system.

To check Python:

python --version

If python is successfully installed, the version of python installed on your system will be displayed.

To check pip

pip -V

The version of pip will be displayed, if it is successfully installed on your system.

Now Install Tkinter

Tkinter can be installed using pip. The following command is run in the command prompt to install Tkinter.

pip install tk

This command will start downloading and installing packages related to the Tkinter library. Once done, the message of successful installation will be displayed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM