Python3.5升级3.7

Preparation

Ubuntu16.04系统自带两个python版本,一个是python2.7,很快就不会维护了,另一个是python3.5,但是目前很多最新库,尤其是深度学习相关的库要求python3.6以上,所以要升级。

1.Download python3.7

 wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz

other versions:https://www.python.org/downloads/source/

2. Decompress

Enter the download directory

tar zxvf Python-3.7.3.tgz
cd Python-3.7.3

3. Compile and Install

./configure --with-ssl
make
sudo make install

attention: the option --with-ssl in order to avoid install error when using pip install

Building The Soft Link

1. Delete the Old Soft Link

sudo rm -rf /usr/bin/python3
sudo rm -fr /usr/bin/pip3

2. Building New Soft Link

Before building the new soft link, you can use “whereis python3.7” command to locate the installation directory.

sudo ln -s /usr/local/bin/python3.7 /usr/bin/python3
sudo ln -s /usr/local/bin/pip3.7 /usr/bin/pip

3. Test

python3 -V
pip3 -V

4. Issues

Terminal will can’t be opened due to it depend on python3.5, now we modify the python3 point to python3.5, so the sw depend on python3.5 will has this issues. Here is a solution:

cd /usr/bin
sudo gedit gnome-terminal

modify the !/usr/bin/python3 to !/usr/bin/python3.5. It will ok.

if this solution can’t solve the issue, try to add "LC_ALL=“en_US.UTF-8” to the /etc/default/locale file end. Then it gone.

  • 2
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值