【Django】CentOS7安装Django笔记

前言

目前的网站八成都是 PHP,但是 python 自己有着强大的数学计算库,为数据挖掘和分析做保证。

安装

Python

找东西一定要去官网,对于国内的网络环境来讲,百度出来的文章更多的都是两三年前的,没有什么参考价值,还会耽误时间。

首先是安装 Python,centos7自带 Python2.7

什么版本python 可以安装 Django

还是有问题去官网的风格

What Python version can I use with Django?¶
Django version Python versions
1.4 2.5, 2.6, 2.7
1.7, 1.8 2.7 and 3.2, 3.3, 3.4
1.9 2.7, 3.4, 3.5
For each version of Python, only the latest micro release (A.B.C) is officially supported. You can find the latest micro version for each series on the Python download page.

Typically, we will support a Python version up to and including the first Django LTS release whose security support ends after security support for that version of Python ends. For example, Python 3.3 security support ends September 2017 and Django 1.8 LTS security support ends April 2018. Therefore Django 1.8 is the last version to support Python 3.3.

手动升级 python3.4.3

为什么不是3.3呢,因为3.4是比较新的版本,并且Django也是支持的,3.3版本到现在时间有些长。。。

官网下载

通过 wget 对官网安装包进行下载

wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz

解压编译安装

tar -xf Python-3.4.3.tar.xz
cd Python-3.4.3/
./configure

出错了 Ignoring ensurepip failure: pip 6.0.8 requires SSL/TLS

yum -y install openssl openssl-devel

Successfully installed pip-6.0.8 setuptools-12.0.5

建立3.4.3的链接

rm -rf /usr/bin/python
ln -s /usr/local/bin/python3.4 /usr/bin/python

注意:将默认的python指向3.4.3以后,yum不能正常使用,需编辑下yum的配置文件:vi /usr/bin/yum
这里需要先将原来的python软连接重名 mv /usr/bin/python /usr/bin/python2.7.5
把文件头部的#!/usr/bin/python改成#!/usr/bin/python2.7.5保存退出即可;

解决启动 python 之前的显示错误

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值