The default version that can be installed on Raspberry Pi using sudo apt-get install is Python 3.4, but many of the new features of Python 3.6 cannot be used, and your own projects cannot be run. So it needs to be upgraded.
#Currently it is not possible to simply install, you can only make and compile it yourself. (Recommended learning: Python video tutorial)
We want to install Python3.6.4 on the Raspberry Pi, so we need to compile and install this version.
The method is as follows:
# 安装编译所需依赖包 sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev # 安装SSL依赖 sudo apt-get install libssl-dev # 到官网下载Python3.6.4: https://www.python.org/downloads/source/ wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz # 解压 tar xf Python-3.6.4.tar.xz # 进入目录 cd Python-3.6.4 # 开始编译(时间漫长,需要等待,建议用&&把三句连在一起执行) sudo ./configure sudo make sudo make install # 升级pip sudo python3.6 -m pip install --upgrade pip
After installing Python3.6, it will display:
For more Python-related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of How to install python3.6.4 to Raspberry Pi 3rd generation. For more information, please follow other related articles on the PHP Chinese website!