最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【未解决】Ubuntu中升级Python 3.5到最新版的Python 3.7

Python crifan 33浏览 0评论
折腾:
【未解决】本地搭建和部署运行Django项目
期间,当前Ubuntu:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial
想要去升级Python 3.5.2
# which python3
/usr/bin/python3
# python3 --version
Python 3.5.2
到最新版的Python 3.7,然后才能用上pipenv install恢复mac中建的Python虚拟环境。
ubuntu python 3 upgrade
How to upgrade to python 3.7 on ubuntu 18.10 – jcutrer.com
https://jcutrer.com/linux/upgrade-python37-ubuntu1810
sudo apt-get install python3.7
sudo update-alternatives –install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives –install /usr/bin/python3 python3 /usr/bin/python3.7 2
software installation – How do I install Python 3.6 using apt-get? – Ask Ubuntu
How to update Python to the latest version on Ubuntu 18.04 – Ask Ubuntu
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install python3.7
感觉不错
python3 – Cannot upgrade in ubuntu 18.04 – Ask Ubuntu
python3 – Upgrading Python 3.6 to 3.7 in Ubuntu 18.04 LTS – Ask Ubuntu
apt – Upgrading to python 3.x – Ask Ubuntu
给Ubuntu升级Python3.7 – lezeqe的博客 – CSDN博客
Ubuntu 16.04 更新 Python 3.7 – k2shouai – Medium
https://medium.com/k2shouai/ubuntu-16-04-更新-python-3-7-f08cee97a64b
# Prepare to build
mkdir /tmp/Python37
cd /tmp/Python37

# Pull down Python 3.7, build, and install
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar xvf Python-3.7.0.tar.xz
cd /tmp/Python37/Python-3.7.0
./configure --enable-optimizations
sudo make altinstall
会安装到:
/usr/local/bin
-》就不会和系统python3冲突了。
python – Python3: Trying to upgrade pip3 in Ubuntu 16.04 but it doesn’t update – Stack Overflow
linux – How to upgrade Python version to 3.7? – Stack Overflow
sudo apt-get update
sudo apt-get install build-essential libpq-dev libssl-dev openssl libffi-dev zlib1g-dev
sudo apt-get install python3-pip python3.7-dev
sudo apt-get install python3.7
Install Python 3.6 on Ubuntu 14.04 and 16.04 LTS – DevOps & Python
Installing the Latest Python 3.7 on Ubuntu 16.04 / 18.04 | Website for Students
也是说,可以源码编译安装
核心是:
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

cd /tmp
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz

tar -xf Python-3.7.2.tar.xz
cd Python-3.7.2
./configure --enable-optimizations

make
sudo make altinstall
还说是:
不要用:
make install
否则会覆盖当前系统中默认Python3的
以及另外一种:
Method 2: Installing Python via PPA
sudo apt update
sudo apt install software-properties-common

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update
sudo apt install python3.7
还是试试
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3.7
结果报错:
【已解决】sudo apt-get update报错:W GPG error  signatures couldn’t be verified because the public key is not available NO_PUBKEY
不过:
sudo apt-get upgrade
比较正常
但是要下载太多东西,很多是从tencent的mirror下载,速度不错。
但有些东西下载是从ppa.launchpad.net下载,太慢,所以受不了了,中断:
...
Get:417 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php5.6-mysql amd64 5.6.40-8+ubuntu16.04.1+deb.sury.org+1 [140 kB]                                   
Get:418 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php5.6-cli amd64 5.6.40-8+ubuntu16.04.1+deb.sury.org+1 [1,285 kB]                                   
99% [418 php5.6-cli 916 kB/1,285 kB 71%]^C  
继续:
sudo apt-get install python3.7
结果找不到:
# sudo apt-get install python3.7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3.7
E: Couldn't find any package by glob 'python3.7'
E: Couldn't find any package by regex 'python3.7'
看来还是要解决前面的sudo apt-get update的问题。
现在已经解决了。
再去:
【已解决】Ubuntu中apt安装python3.7报错:Ubuntu E Unable to locate package python3.7
结果又遇到:
【未解决】Ubuntu中apt-get安装报错:dpkg: error processing package mysql-server

转载请注明:在路上 » 【未解决】Ubuntu中升级Python 3.5到最新版的Python 3.7

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
17 queries in 0.085 seconds, using 9.43MB memory