折腾:
【未解决】本地搭建和部署运行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
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
sudo apt-get update && sudo apt-get upgrade sudo apt-get install python3.7
感觉不错
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冲突了。
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
也是说,可以源码编译安装
核心是:
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