avatar

You know what bothers me everytime I get back on a Debian-like system ? The Python version. I mean... Come on, it's 2015, let's switch to 3.4 ! So I wanted to do so on my Raspberry Pi (the first version) because I finally decided to improve my electronic skills. First thing I wanted to try are the GPIO. I know it works fine on the Python version installed on Raspbian by default. But I wanted to code in 3.4 so let's see how we can setup a Raspbian with Python 3.4 that can handles the GPIO !


Install and connect to your Raspbian

First of all, install Raspbian on your SD Card. Download Page - Tutorial to Install Raspbian on your SD Card
There is an automatic DHCP when Raspbian starts and SSH is now activated by default on the latest versions of Raspbian. So once your Raspberry is started, you may be able to get its IP address on your internet equipment web ui (192.168.1.1 or something like that). If the web ui doesn't provide such information, you can run nmap to find out. nmap -sn 192.168.1.0/24 The -sn flag is the ping flag and allows to find every equipment connected to your local network. Now get your Raspberry's IP and connect to it using ssh. For clarity purpose, on the following line, 192.168.1.12 is just an example. ssh pi@192.168.1.12 The password is raspberry. It's the default password and you should change it immediatly by the way.


Download dependencies

Now, you'll want to install Python 3.4, but you'll soon find out that you won't have pip installed unless you install the ssl libs before.

pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install libssl-dev openssl

That's right, pip needs SSL/TLS support and will complain like crazy if those libssl and openssl are not installed.


Download, Compile and Install Python 3.4

Finally, your wish to do a make and a make install has come true ! Let's download the latest Python version using wget, extract the archive, configure, make and make install. Compiling Python can take more than one hour on Raspberry, so be patient

pi@raspberrypi ~ $ wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
pi@raspberrypi ~ $ tar xvf Python-3.4.3.tar.xz
pi@raspberrypi ~ $ cd Python-3.4.3/
pi@raspberrypi ~ $ ./configure   # You can set a prefix here
pi@raspberrypi ~ $ make
pi@raspberrypi ~ $ sudo make install

Now that you waited for like an hour and thirty minutes, the latest python version is now installed.


Create a virtualenv and download the right libs

I'm pretty sure that if you want to download and compile the latest Python version, you also know what's a virtualenv. If not, here is a guide. But did you know that Python 3.4 comes with an integrated virtualenv ? It's called pyvenv-3.4. Once you have created a virtualenv (as described below) you'll need to install the RPi.GPIO package with pip. Here is the list of command lines that allows you to do that.

pi@raspberrypi ~ $ pyvenv-3.4 env
pi@raspberrypi ~ $ source env/bin/activate
# If (and only if) source doesn't work :
# pi@raspberrypi ~ $ . env/bin/activate
(env) pi@raspberrypi ~ $ pip install RPi.GPIO

Now you're ready !

Syntax Highlighter Theme

You now have the ability to choose the theme of your syntax highlighting. If you want to have a look at what each theme looks like, you can go here. All credits for those themes goes to Richard Leland, here is the GitHub Repository of the themes. Don't hesitate to change the theme to whatever feels better to you and give me some feedback if there is a bug with one of the themes.

Truncated Articles

You now have the ability to choose if you want to truncate your articles on your blog index page. Meaning if you think your articles are too long, they can be truncated for about 300 chars. (It truncates the HTML directly). It adds a link at the bottom of the truncated article to access the full article (which can also be achieved by clicking the article's title).

09-03-2015 15:51 by depado

Feedback Request

For the past few weeks I have been inactive on that project, mainly for personnal reasons and lack of time. But my ideas are still there, and I want to keep developping this blog engine.

Why do I ask for feedback ?

I have been showing this website to some friends and everyone asks me the same question : What's the point ? What's the purpose of this ?
I think I don't really know how to introduce this website. Some people think it's just my personnal blog. Other people think it's a software they need to install on their server to make it work. It's a blogging engine that uses Markdown as content. It allows you to create your own blog with its own subdomain and to customize it. That's why I'd love to get some feedback about what could be improved. I already detected many problems, mainly with Https which I intend to fix soon. Here are some places you can comment and help me improve MarkDownBlog : OpenClassrooms Topic (French) GitHub Repository (English and French) Using the issue feature