如何将Django升级到2.0版本

时间:2018-02-19 19:24:14

标签: python django linux pip

我一直在努力升级我的djangóversión而且我已经做好了。

xxx@yyyyyy:~# python
Python 2.7.12 (default, Nov 20 2017, 18:23:56) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(1, 11, 10, u'final', 0)

xxxx@yyyyyyy:~# pip install -U Django 
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already up-to-date: Django in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: pytz in /usr/local/lib/python2.7/dist-packages (from Django)

xxxx@yyyyyy:~# pip --no-cache-dir install -U Django
Requirement already up-to-date: Django in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: pytz in /usr/local/lib/python2.7/dist-packages (from Django)

如果enter code here它不是2.0,它是如何更新我的django版本的(1,11,10,u'final',0)

如果我做一个ls -s来了解文件所有者:

xxxx@yyyyyyy:~# ls -s /home/gechichure/.cache/pip
total 12
4 http  4 selfcheck.json  4 wheels

不是root或我的useradmin?!?!?!我不明白django是如何工作的以及它是如何工作的:(

我需要升级到2.0versión!!

请提出任何建议。

问候!!!

1 个答案:

答案 0 :(得分:2)

Django 2.0不适用于Python 2.7,所以你应该安装Python 3来使用它。我建议制作一个不存在安装问题的virtualenv。

按照以下步骤操作,您将获得成功:) https://help.dreamhost.com/hc/en-us/articles/115000695551-Installing-and-using-Python-s-virtualenv-using-Python-3