首页 > 代码库 > Centos 6.6 安装python3.6及Django1.10.5

Centos 6.6 安装python3.6及Django1.10.5

一、安装环境检查一下包是否安装 

yum install gcc 
yum install zlib-devel 
yum install make

yum install -y openssl openssl-devel

二、开始安装python3.6

wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar vxf Python-3.6.1.tgz
cd Python-3.6.1.tgz
 ./configure --prefix=/usr/local   #编译,自定义安装目录,如果自定目录不在环境变量重要,要把安装的目录加入到环境变量中
  make && make install  #这个过程会非常慢 
ln –s /usr/local/bin/python3 /usr/bin/python3  #建立软连接

三、检查是否安装成功

[root@ly ~]# python3
Python 3.6.1 (default, Aug  5 2017, 23:14:39)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

四、安装Django==1.10.5

安装完成 python3.6后应该是自动安装了pip9.0.1
所以直接安装django
pip install django==1.10.5
然后做软连接
ln -s /usr/local/bin/django-admin.py /usr/bin/django-admin

五、检查django的命令是否能运行

[root@ly ~]# django-admin

Type ‘django-admin help <subcommand>‘ for help on a specific subcommand.

Available subcommands:

[django]
    check
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    loaddata
    makemessages
    makemigrations
    migrate
    runserver

运行django-admin的命令查看能否出现 如下的子命令,如果没有请 创建软连接或者添加环境变量
1、ln -s /usr/local/bin/django-admin.py /usr/bin/django-admin

2、
export PATH=$PATH:/usr/local/python3/bin‘
 

 

Centos 6.6 安装python3.6及Django1.10.5