python3.7安装

安装

https://my.oschina.net/mengyoufengyu/blog/2248239

树莓派3b+编译安装Python3.7.0 

mbzhong
  mbzhong 发布于 2018/10/17 21:47
 
字数 194
 
阅读 5.2K
 
 收藏 0
   

一、更新树莓派系统

sudo apt-get update
sudo apt-get upgrade

二、安装python需要的依赖

sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev

三、下载Python的源代码并解压 

cd mydownload
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar zxvf Python-3.7.0.tgz

四、配置、编译、安装 

sudo mkdir /usr/local/python370
sudo ./configure --prefix=/usr/local/python370
sudo make
sudo make install

五、创建符号链接

sudo ln -s /usr/local/python370/bin/python3 /usr/bin/python370
sudo ln -s /usr/local/python370/bin/python3 /usr/bin/python3.7.0
sudo ln -s /usr/local/python370/bin/pip3 /usr/bin/pip370
sudo ln -s /usr/local/python370/bin/pip3 /usr/bin/pip3.7.0

六、测试

python370 --version

https://blog.csdn.net/liqiancao/article/details/94712863?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param

树莓派删除Python2.7 默认Python3.7

树莓派自带python2和3版本,要想使用3的话,还得特地敲python3、pip3等等一系列的指令

但是python2我们基本上都已经不学了

所以删除python2.7,输入:

sudo apt-get autoremove python2.7

卸载完后,我们发现想用python3的时候,还得敲python3

想敲python直接出来python3的话,那么先把python链接删掉:

sudo rm /usr/bin/python
 

载新建一个链接:

sudo ln -s /usr/bin/python3.7 /usr/bin/python

查看版本:

python

显示如下:

  1.  
    Python 3.7.3 (default, Apr 3 2019, 05:39:12)
  2.  
    [GCC 8.2.0] on linux
  3.  
    Type "help", "copyright", "credits" or "license" for more information.
原文地址:https://www.cnblogs.com/kekeoutlook/p/13417549.html