SoFunction
Updated on 2024-10-30

python3.5 install python3-tk details

After installing matplotlib under python3.5, I was ready to display a picture to test it, but the console reported an error saying that I needed to install python3-tk, which I naively thought was straightforward:

sudo apt-get install python3-tk

It would be fine. But it doesn't work, it says it can't find the corresponding resources. I started all kinds of Baidu, Google, all kinds of posts on the Internet, still did not solve my problem. Then I found a python3-tk installer in deb format. I thought that would be fine, and started to execute it:

sudo dpkg -i .....deb

Found out it depends on blt, what the hell is this, whatever, install it first. This again all kinds of not work, all kinds of dependencies. So I was tossed around for hours, almost doubting my life. Back to the original starting point, staring blankly at the error. I suddenly had a ripple in my heart. Didn't I say that I couldn't match the corresponding source? Then I'll change the source for you, so I warily changed the Tsinghua mirror source to the one that comes with ubuntu, and then updated the source. After about 3 minutes of updating, a box popped up in front of my eyes, a box that almost made me cry, python3-tk. I clicked start and it didn't respond, so I thought I'd just give up.

Let's try it again from the command line.

sudo apt-get install python3-tk

Prompt me to run it.

sudo apt-get install -f

When I ran the program again, my dear pictures actually appeared before my eyes. God, it's a good thing I didn't give up.
The solution is actually quite simple.

1. Source change

2, update sudo apt-get update

3、sudo apt-get install python3-tk

4、sudo apt-get install -f

That's it. Go up to the chart that shows it:

tkinter is a python interface library for calling tcl/tk programs, so there are usually libraries installed at the operating system level rather than relying solely on pip3 to install the appropriate python libraries, e.g., python3-tk.

devel library installation, in *unix system, in the middle of development, many cases are required to devel library installation, this is a probable rule.

In some cases, the installation may be incomplete or the installation may be missing some libraries. In this case, you can consider overriding the installation, e.g. tcl/tk, python3.

Emphasis is placed on the analysis of error messages and directional guidance. In this case, the key message has 2 parts, one, woulde is not installed or not found, then try to solve it from the direction of installing the library. Second, assuming that the package has been installed, but not properly configured. I preferred the first idea when solving the problem; after encountering various failed attempts, I had to turn to the second idea to solve the problem. The problem could have been solved faster if it had been solved from both directions.

The above is a small introduction to python3.5 install python3-tk detailed integration, I hope to help you, if you have any questions please leave me a message, I will promptly reply to you. I would also like to thank you very much for your support of my website!