Compiling and installing a new version of Python on a Raspberry Pi

Source: Internet
Author: User
Tags sqlite

Raspiban wheezy is pre-installed Python3 is 3.2.3, this tutorial lets you upgrade to 3.4.1 (currently the latest version).

I used a B-plus Raspberry Pi, which was released in 2014-06-20 by Raspbian Wheezy.

The entire Raspbian system is upgraded to the latest, and may require a reboot after the upgrade.

1 sudo Update 2 sudo upgrade

Let's do it in the home directory of the current user, go to this directory

CD ~

the dependencies required for installing Python. Some things may already exist and will be ignored automatically.

sudo Install bzip2 Libbz2-dev

download Python source code, unzip. when you see this article, there may be a newer version of Python.

The 2nd Line of command, will extract the source code into the current directory in the Python-3.4.1 directory.

1 wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz2tar ZXVF python-3.4. 1. tgz

configure, compile, install. if it goes well, it takes about 1 hours and 20 minutes.

The parameters of line 2nd indicate that we want to install the new Python into the/opt/python3.4 directory

1 CD./python-3.4. 1 2 ./configure--prefix=/opt/python3. 4 3  Make sudo  Make Install

Create a soft link. this way, you can start Python 3.4.1 by playing Python3.

The first line removes existing soft links to Python 3.2.3.

The second line creates the/usr/bin/python3 this soft link to the Python 3.4.1.

The third line creates a soft link for the PIP. PIP has been officially integrated into the python3.4, and it is convenient to install the third-party module on the PyPI.

1 sudo rm /usr/bin/python32sudoln -s/opt/python3. 4/bin/python3. 4   /usr/bin/python33sudoln -s/opt/python3. 4/BIN/PIP3. 4         /usr/bin/pip-3.4

At this point, the installation is successful, playing Python3 can start Python 3.4.1

Need to explain, in the compiled 3.4.1 can use SQLite normally, but the version of SQLite is older:

The version of SQLite that comes with the Python 3.4.1 on Windows is 3.8.3.1 because of the use of Raspbian's own SQLite, which can also occur with other linked modules.

Compiling and installing a new version of Python on a Raspberry Pi

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.