2. Centos7下python3安装django

2022-01-17 13:46:34 浏览数 (1)

安装django

安装django的方法

代码语言:javascript复制
pip install Django  #默认最新版本

或者

代码语言:javascript复制
pip install Django==1.10.1  #指定1.10.1版本

在Centos7使用pip3安装看看

代码语言:javascript复制
[root@centos7 ~]# pip3 install Django
Collecting Django
  Downloading https://files.pythonhosted.org/packages/54/85/0bef63668fb170888c1a2970ec897d4528d6072f32dee27653381a332642/Django-2.2-py3-none-any.whl (7.4MB)
    100% |████████████████████████████████| 7.5MB 681kB/s
Collecting sqlparse (from Django)
  Downloading https://files.pythonhosted.org/packages/ef/53/900f7d2a54557c6a37886585a91336520e5539e3ae2423ff1102daf4f3a7/sqlparse-0.3.0-py2.py3-none-any.whl
Collecting pytz (from Django)
  Downloading https://files.pythonhosted.org/packages/3d/73/fe30c2daaaa0713420d0382b16fbb761409f532c56bdcc514bf7b6262bb6/pytz-2019.1-py2.py3-none-any.whl (510kB)
    100% |████████████████████████████████| 512kB 815kB/s
Installing collected packages: sqlparse, pytz, Django
Successfully installed Django-2.2 pytz-2019.1 sqlparse-0.3.0
You are using pip version 19.0.2, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@centos7 ~]#

安装完毕之后,查看一下版本,如下:

代码语言:javascript复制
[root@centos7 ~]# ipython3
Python 3.7.1 (default, Feb 18 2019, 11:27:32)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import django

In [2]: print(django.get_version())
2.2

In [3]:

可以看到本次安装的是 2.2 版本的 django

其实windows的安装方式也是一样的。

0 人点赞