腾讯云安装python36

安装对应的 Release 

yum -y install epel-release

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-12 will be installed
--> Finished Dependency Resolution

#得到ius-release.rpm
  
[root@localhost ~]# wget https://centos7.iuscommunity.org/ius-release.rpm


 [root@VM_0_14_centos ~]# rpm -ivh ius-release.rpm 
warning: ius-release.rpm: Header V4 RSA/SHA256 Signature, key ID 4b274df2: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:ius-release-2-1.el7.ius          ################################# [100%]

安装python36

#安装python36
 [root@VM_0_14_centos ~]# yum install -y python36u
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Package python36u is obsoleted by python3, trying to install python3-3.6.8-10.el7.x86_64 instead

安装pip

[root@VM_0_14_centos ~]# yum install -y python36u-pip python36u-devel
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Package python36u-pip is obsoleted by python3-pip, trying to install python3-pip-9.0.3-7.el7_7.noarch instead

修改pip源  

[root@VM_0_14_centos ~]# mkdir ~/.config/pip/
vim ~/.config/pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

保存退出                           

配置虚拟环境

更新完成后,在 Home 目录下创建一个 django 的测试项目,用于我们后续的测试。

正式项目部署时也参考这里的步骤

cd /home/
mkdir django
cd django
python3.6 -m venv venv

安装django

. venv/bin/activate
pip install django==2.1.8

猜你喜欢

转载自www.cnblogs.com/xiao-apple36/p/12563585.html