手动安装 python 3.7 + pip ssl 出错 + pipenv 出错
WARNING: pip is configured with locations that require TLS/SSL, however the...
注:以下步骤有啥问题就开sudo
先下载python并解压:
wget https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tgz
tar zxvf Python-3.7.10.tgz
cd Python-3.7.10/
然后先装openssl和readline(不然各种附加按键会出问题,比如退格键变为^H
):
进入
vim Modules/Setup
vim Modules/Setup.dist
上面两个文件都去168行左右,把
# readline readline.c -lreadline -ltermcap
取消注释变为
readline readline.c -lreadline -ltermcap
然后:
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get -y install libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get -y install libreadline-dev
sudo apt-get -y install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get -y install libssl-dev openssl
sudo apt-get -y install libffi-dev
手动安装python:
./configure --with-ssl
make
make test #如果赶时间就不用这句,是一些复杂的优化,阿里云四核8G大约用了半小时?
make install
系统中如果原来有其它版本python需要设置软连接,可以参考这里
pipenv出错:
pipenv...
An error occurred while installing ...
解决:
编辑Pipfile:
加入
[requires]
python_version = {$your_python_version}