我正在尝试升级virtualenv中的django版本,并显示django已更新但仍未更新。
D:\testEnv>tan\Scripts\activate.bat
(tan) D:\testEnv>pip freeze
BeautifulSoup==3.2.1
Django==1.4.3
distribute==0.6.15
django-export-xls==0.1.1
jdcal==1.0
openpyxl==2.0.4
pypm==1.3.4
pythonselect==1.3
pywin32==214
virtualenv==1.6.1
wsgiref==0.1.2
xlwt==0.7.5
(tan) D:\testEnv>pip install Django --upgrade
Downloading/unpacking Django
Downloading Django-1.7.1.tar.gz (7.5Mb): 7.5Mb downloaded
Running setup.py egg_info for package Django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
Installing collected packages: Django
Found existing installation: Django 1.4.3
Not uninstalling Django at c:\python27\lib\site-packages, outside environment D:\testEnv\tan
Running setup.py install for Django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
Installing django-admin-script.py script to D:\testEnv\tan\Scripts
Installing django-admin.exe script to D:\testEnv\tan\Scripts
Successfully installed Django
Cleaning up...
(tan) D:\testEnv>pip freeze
BeautifulSoup==3.2.1
Django==1.4.3
distribute==0.6.15
django-export-xls==0.1.1
jdcal==1.0
openpyxl==2.0.4
pypm==1.3.4
pythonselect==1.3
pywin32==214
virtualenv==1.6.1
wsgiref==0.1.2
xlwt==0.7.5
(tan) D:\testEnv>python
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> dir(django)
['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'get_version']
>>> django.get_version
<function get_version at 0x022F7AB0>
>>> django.get_version()
'1.4.3'
>>>
因为升级后我的django旧版本是1.4.1,它应该是1.7.1并且显示消息成功安装Django 但仍然显示旧版本的django。 那我该如何在这里更新我的django版本呢。另外,我需要帮助来更新django版本1.6.1。
答案 0 :(得分:1)
我认为关键在于:
Not uninstalling Django at c:\python27\lib\site-packages, outside environment D:\testEnv\tan
你的virtualenv之外有一个django安装,不知怎的,它忽略了你正在安装并使用那个安装的那个。删除它,然后再试一次。
作为旁注,我尝试在windows中使用django / python很长一段时间......然后放弃了乞讨窗口让我工作并切换到另一个SO。如果你想留在Windows我建议你至少使用vagrant,从长远来看会让你的生活更轻松。