Python GUI Guide: Introduction to Tkinter

I’m attempting to work through the tutorial “Python GUI Guide: Introduction to Tkinter”. The first hurdle I’ve encountered is the tutorial is using Python 3.5.3. I’ve used apt-get to update my Pi, but I’m seeing Python version 3.4.2. How do I download and install Python 3.5.3 when the distribution says I have the most current?

I redirected pip to pip3, (as explained in the tutorial). When I type and enter “pip --version” the monitor displays “pip 1.5.6 from usr/lib/python3/dist-packages (python 3.4)”. Is this installer correct?

When I attempt to use pip to install cairocffi (pip install cairocffi) as shown in the tutorial, I end up with an error message ". . . compile fail . . . "

I get similar results with the install of matplotlib (pip install matplotlib) “. . . failed with error code 1 . . .”

What do I need to do to get the software installed so I can work through the tutorial?

Hi Dave,

What model Pi and OS are you using? You should be able to manually update the version of Python on your Pi by following the instructions [here.

From there, you should be able to follow along with the rest of the tutorial without issue. I hope this helps and if you continue to have issues, let us know and we would be happy to help.](Installing Python 3.5 on Raspbian · GitHub)

I’m using a Raspberry Pi 3 Model B V1.2

Entering “uname -a” in a terminal shell reveals “Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux”

As I said earlier, I’ve run all of the apt-get updates, upgrades and installs, so I think the software should be up-to-date. If not then I need to know more/better info about upgrading.

Entering “more /etc/issue” produces “Raspbian GNU/Linux 8 \n \l”

What is the latest version of Linux OS for the Raspberry Pi?

I manually installed Python 3.5.7 as suggested by the “here” link shown above.

During the “sudo make install” step the software complains about not finding “_pickle”. I went ahead and performed the installation of “cairocffi” with the new pip; this went well. Then I attempted the install of “matplotlib”; all goes well until:

“running install_lib”

“creating /usr/local/lib/python3.5/site-packages/numpy”

“error: could not create ‘/usr/local/lib/python3.5/site-packages/numpy’: Permission denied”

Should I be using “sudo pip install matplotlib”?

Hi Dave,

That error is because you do not have access to the root directory you are trying to install to. I apologize for the confusion here but I would recommend reverting back to a previous install or running a fresh install of Rasbpian and then following the instructions in our [Python Programming Tutorial for the Raspberry Pi. That will take you through the instructions to use Python 3 instead of 2 and will get the pip version updated as well. From there, you can move on to the exercises in the [Introduction to Tkinter tutorial.](https://learn.sparkfun.com/tutorials/python-gui-guide-introduction-to-tkinter/)](https://learn.sparkfun.com/tutorials/python-programming-tutorial-getting-started-with-the-raspberry-pi/all#configure-your-pi)