Django和Python的版本对应
Django | Python |
---|---|
1.8 | 2.7,3.2,3.3,3.4,3.5 |
1.9、1.10 | 2.7,3.4,3.5 |
1.11 | 2.7,3.4,3.5,3.6 |
2.0 | 3.4,3.5,3.6 |
2.1,2.2 | 3.5,3.6,3.7 |
3.0,3.1 | 3.6,3.7,3.8 |
Debian
下载解压
# 下载
wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
# 解压
tar -xzvf Python-3.9.1.tgz
# 配置
apt-get install gcc patch libffi-devel python3-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
# 只当文件夹
mkdir /usr/local/python39
# 生成脚本
cd Python-3.9.1
./configure --with-ssl --prefix=/usr/local/python39
# 编译
make
# 安装
make install
配置
# python
rm /usr/bin/python3 # 删除老版本的关联
ln -s /usr/local/python3.9/bin/python3.9 /usr/bin/python3 # 建立新关联
# pip
rm /usr/local/bin/pip3 # 删除老版本的关联
ln -s /usr/local/python3.9/bin/pip3 /usr/local/bin/pip3 # 建立新关联
虚拟环境
sudo pip3 install virtualenv
sudo pip3 install virtualenvwrapper
sudo vim ~/.bashrc
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/python39/bin/virtualenv
source /usr/local/python39/bin/virtualenvwrapper.sh
source ~/.bashrc
mkvirtualenv -p /usr/bin/python3 flask # 指定虚拟环境flask中python解释器来源为/usr/bin/python3
workon [虚拟环境名] # 进入虚拟环境
deactive # 退出虚拟环境
rmvirtualenv [虚拟环境名] # 删除虚拟环境
lsvirtualenv # 查看已创建的虚拟环境
cdvirtualenv # 快捷进入虚拟环境目录
cdsitepackages # 快捷进入虚拟环境包安装目录
报错
Could not find a version that satisfies the requirement setuptools_scm
pip install setuptools-scm
subprocess.CalledProcessError: Command ‘(‘lsb_release’, ‘-a’)’ returned non-zero exit status 1.
sudo rm /usr/bin/lsb_release
评论区