我正在尝试做djangocms教程。
我的笔记本电脑(在Archlinux上)一切都很好,但我试图在另一台计算机上继续使用该项目(使用Mac OS X)。
我创建了git clone
,开始了一个新的 virtualenv 并试图做pip install -r requirements.txt
。
以下是 requirements.txt 的内容(我是从pip freeze
输出中获得的):
dj-database-url==0.3.0
Django==1.6.11
django-classy-tags==0.6.2
django-cms==3.1.2
django-reversion==1.8.5
django-sekizai==0.8.2
Django-Select2==4.3.1
django-treebeard==3.0
djangocms-admin-style==0.2.7
djangocms-column==1.5
djangocms-file==0.1
djangocms-flash==0.2.0
djangocms-googlemap==0.2
djangocms-inherit==0.1
djangocms-installer==0.7.8
djangocms-link==1.6.2
djangocms-picture==0.1
djangocms-style==1.5
djangocms-teaser==0.1
djangocms-text-ckeditor==2.5.2
djangocms-video==0.1
html5lib==0.99999
Pillow==2.8.0
-e git+http://git@github.com/divio/django-polls.git@9fb91e49e2e56cf59ab0cfcddb17c35afbdd06da#egg=polls-master
pytz==2015.4
six==1.9.0
South==1.0.2
tzlocal==1.2
wheel==0.24.0
但是pip install
之后的 django版是 Django 1.7.4 (而不是 Django 1.6.11 )。
我不明白为什么。
以下是pip freeze
:
dj-database-url==0.3.0
Django==1.7.4
django-classy-tags==0.6.2
django-cms==3.1.2
django-reversion==1.8.5
django-sekizai==0.8.2
Django-Select2==4.3.1
django-treebeard==3.0
djangocms-admin-style==0.2.7
djangocms-column==1.5
djangocms-file==0.1
djangocms-flash==0.2.0
djangocms-googlemap==0.2
djangocms-inherit==0.1
djangocms-installer==0.7.8
djangocms-link==1.6.2
djangocms-picture==0.1
djangocms-style==1.5
djangocms-teaser==0.1
djangocms-text-ckeditor==2.5.2
djangocms-video==0.1
html5lib==0.99999
pbr==0.10.7
Pillow==2.8.0
-e git+http://git@github.com/divio/django-polls.git@9fb91e49e2e56cf59ab0cfcddb17c35afbdd06da#egg=polls-master
pytz==2015.4
six==1.9.0
South==1.0.2
stevedore==1.2.0
tzlocal==1.2
virtualenv==13.1.0
virtualenv-clone==0.2.5
virtualenvwrapper==4.6.0
wheel==0.24.0
以下是pip install -r requirements.txt
:
/Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Envs/djangocms/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting dj-database-url==0.3.0 (from -r requirements.txt (line 1))
/Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Envs/djangocms/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading dj_database_url-0.3.0-py2.py3-none-any.whl
Collecting Django==1.6.11 (from -r requirements.txt (line 2))
Downloading Django-1.6.11-py2.py3-none-any.whl (6.7MB)
100% |████████████████████████████████| 6.7MB 75kB/s
Collecting django-classy-tags==0.6.2 (from -r requirements.txt (line 3))
Downloading django_classy_tags-0.6.2-py2-none-any.whl
Collecting django-cms==3.1.2 (from -r requirements.txt (line 4))
Downloading django_cms-3.1.2-py2.py3-none-any.whl (3.0MB)
100% |████████████████████████████████| 3.0MB 150kB/s
Collecting django-reversion==1.8.5 (from -r requirements.txt (line 5))
Downloading django-reversion-1.8.5.tar.gz (57kB)
100% |████████████████████████████████| 61kB 4.1MB/s
Collecting django-sekizai==0.8.2 (from -r requirements.txt (line 6))
Downloading django_sekizai-0.8.2-py2.py3-none-any.whl
Collecting Django-Select2==4.3.1 (from -r requirements.txt (line 7))
Downloading Django-Select2-4.3.1.tar.gz (97kB)
100% |████████████████████████████████| 98kB 3.0MB/s
Collecting django-treebeard==3.0 (from -r requirements.txt (line 8))
Downloading django-treebeard-3.0.tar.gz (93kB)
100% |████████████████████████████████| 94kB 1.8MB/s
Collecting djangocms-admin-style==0.2.7 (from -r requirements.txt (line 9))
Downloading djangocms_admin_style-0.2.7-py2.py3-none-any.whl (484kB)
100% |████████████████████████████████| 487kB 834kB/s
Collecting djangocms-column==1.5 (from -r requirements.txt (line 10))
Downloading djangocms_column-1.5-py2-none-any.whl (127kB)
100% |████████████████████████████████| 131kB 1.7MB/s
Collecting djangocms-file==0.1 (from -r requirements.txt (line 11))
Downloading djangocms_file-0.1-py2-none-any.whl (120kB)
100% |████████████████████████████████| 122kB 2.8MB/s
Collecting djangocms-flash==0.2.0 (from -r requirements.txt (line 12))
Downloading djangocms_flash-0.2.0-py2-none-any.whl (121kB)
100% |████████████████████████████████| 122kB 3.9MB/s
Collecting djangocms-googlemap==0.2 (from -r requirements.txt (line 13))
Downloading djangocms_googlemap-0.2-py2-none-any.whl (193kB)
100% |████████████████████████████████| 196kB 2.4MB/s
Collecting djangocms-inherit==0.1 (from -r requirements.txt (line 14))
Downloading djangocms_inherit-0.1-py2-none-any.whl (131kB)
100% |████████████████████████████████| 135kB 2.5MB/s
Collecting djangocms-installer==0.7.8 (from -r requirements.txt (line 15))
Downloading djangocms_installer-0.7.8-py2.py3-none-any.whl (47kB)
100% |████████████████████████████████| 49kB 3.9MB/s
Collecting djangocms-link==1.6.2 (from -r requirements.txt (line 16))
Downloading djangocms_link-1.6.2-py2-none-any.whl (151kB)
100% |████████████████████████████████| 151kB 1.3MB/s
Collecting djangocms-picture==0.1 (from -r requirements.txt (line 17))
Downloading djangocms_picture-0.1-py2-none-any.whl (154kB)
100% |████████████████████████████████| 155kB 2.6MB/s
Collecting djangocms-style==1.5 (from -r requirements.txt (line 18))
Downloading djangocms-style-1.5.tar.gz
Collecting djangocms-teaser==0.1 (from -r requirements.txt (line 19))
Downloading djangocms_teaser-0.1-py2-none-any.whl (121kB)
100% |████████████████████████████████| 122kB 3.0MB/s
Collecting djangocms-text-ckeditor==2.5.2 (from -r requirements.txt (line 20))
Downloading djangocms_text_ckeditor-2.5.2-py2.py3-none-any.whl (1.6MB)
100% |████████████████████████████████| 1.6MB 303kB/s
Collecting djangocms-video==0.1 (from -r requirements.txt (line 21))
Downloading djangocms_video-0.1-py2-none-any.whl (176kB)
100% |████████████████████████████████| 180kB 1.1MB/s
Collecting html5lib==0.99999 (from -r requirements.txt (line 22))
Downloading html5lib-0.99999.tar.gz (887kB)
100% |████████████████████████████████| 888kB 493kB/s
Collecting Pillow==2.8.0 (from -r requirements.txt (line 23))
Downloading Pillow-2.8.0-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (2.8MB)
100% |████████████████████████████████| 2.8MB 162kB/s
Obtaining polls-master from git+http://git@github.com/divio/django-polls.git@9fb91e49e2e56cf59ab0cfcddb17c35afbdd06da#egg=polls-master (from -r requirements.txt (line 24))
Cloning http://git@github.com/divio/django-polls.git (to 9fb91e49e2e56cf59ab0cfcddb17c35afbdd06da) to /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Envs/djangocms/src/polls-master
Could not find a tag or branch '9fb91e49e2e56cf59ab0cfcddb17c35afbdd06da', assuming commit.
Collecting pytz==2015.4 (from -r requirements.txt (line 25))
Downloading pytz-2015.4-py2.py3-none-any.whl (475kB)
100% |████████████████████████████████| 475kB 1.1MB/s
Requirement already satisfied (use --upgrade to upgrade): six==1.9.0 in /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages (from -r requirements.txt (line 26))
Collecting South==1.0.2 (from -r requirements.txt (line 27))
Downloading South-1.0.2.tar.gz (96kB)
100% |████████████████████████████████| 98kB 3.3MB/s
Collecting tzlocal==1.2 (from -r requirements.txt (line 28))
Downloading tzlocal-1.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): wheel==0.24.0 in /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Envs/djangocms/lib/python2.7/site-packages (from -r requirements.txt (line 29))
Requirement already satisfied (use --upgrade to upgrade): argparse in /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages (from djangocms-installer==0.7.8->-r requirements.txt (line 15))
Requirement already satisfied (use --upgrade to upgrade): pip in /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Envs/djangocms/lib/python2.7/site-packages (from djangocms-installer==0.7.8->-r requirements.txt (line 15))
Building wheels for collected packages: django-reversion, Django-Select2, django-treebeard, djangocms-style, html5lib, South, tzlocal
Running setup.py bdist_wheel for django-reversion
Stored in directory: /nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Caches/pip/wheels/51/b4/ea/033db3e78df246021ef65c216c3f716efd5882021289378705
Running setup.py bdist_wheel for Django-Select2
Stored in directory: /nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Caches/pip/wheels/a7/e2/92/a069a90e2595d4a5dbc9f0609d52d8bea9555e42153828eebb
Running setup.py bdist_wheel for django-treebeard
Stored in directory: /nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Caches/pip/wheels/73/8e/8b/3d72e01575557ffeeb1ef648581006d468a415ed868abbfb5d
Running setup.py bdist_wheel for djangocms-style
Stored in directory: /nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Caches/pip/wheels/5b/80/87/41ea156cdab7a7a170122f3a3b77af473ae855612d4d88d6a2
Running setup.py bdist_wheel for html5lib
Stored in directory: /nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Caches/pip/wheels/44/5c/08/f97a40f63f914c4c3a9798e1ff5606b5ab19fe5dcfb64e27b6
Running setup.py bdist_wheel for South
Stored in directory: /nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Caches/pip/wheels/11/2b/ca/a57966e1943759859dd94f3ebc5c279450bee11e07d600e3a3
Running setup.py bdist_wheel for tzlocal
Stored in directory: /nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Caches/pip/wheels/39/8d/3b/21db6b23bc7483a2e1cf391865427e8fbd090223d9db2cfab3
Successfully built django-reversion Django-Select2 django-treebeard djangocms-style html5lib South tzlocal
Installing collected packages: dj-database-url, Django, django-classy-tags, django-sekizai, django-treebeard, djangocms-admin-style, html5lib, django-cms, django-reversion, Django-Select2, djangocms-column, djangocms-file, djangocms-flash, djangocms-googlemap, djangocms-inherit, pytz, tzlocal, djangocms-installer, djangocms-link, djangocms-picture, djangocms-style, djangocms-teaser, Pillow, djangocms-text-ckeditor, djangocms-video, polls-master, South
Found existing installation: Django 1.7.4
Not uninstalling Django at /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages, outside environment /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Envs/djangocms
Running setup.py develop for polls-master
Successfully installed Django-1.7.4 Django-Select2-4.3.1 Pillow-2.8.0 South-1.0.2 dj-database-url-0.3.0 django-classy-tags-0.6.2 django-cms-3.1.2 django-reversion-1.8.5 django-sekizai-0.8.2 django-treebeard-3.0 djangocms-admin-style-0.2.7 djangocms-column-1.5 djangocms-file-0.1 djangocms-flash-0.2.0 djangocms-googlemap-0.2 djangocms-inherit-0.1 djangocms-installer-0.7.8 djangocms-link-1.6.2 djangocms-picture-0.1 djangocms-style-1.5 djangocms-teaser-0.1 djangocms-text-ckeditor-2.5.2 djangocms-video-0.1 html5lib-0.99999 polls-master pytz-2015.4 tzlocal-1.2
Django 1.7.4 似乎最终安装完毕。
为什么?
我怎么能避免这个?我当前的项目无法使用此版本,教程需要 Django 1.6 。
编辑:
我刚刚发现,在我的virtualenv的 site-packages 中,django的版本是 1.6.11 。所以我的virtualenv可能会使用错误的site-package。
为什么?
我该如何解决这个问题?
通常,当我们使用virtualenv时,是否应该使用正确的 site-package 目录?
答案 0 :(得分:0)
pip install -r requirements.txt
输出的最后5行为您提供答案:
Successfully built django-reversion Django-Select2 django-treebeard djangocms-style html5lib South tzlocal
Installing collected packages: dj-database-url, Django, django-classy-tags, django-sekizai, django-treebeard, djangocms-admin-style, html5lib, django-cms, django-reversion, Django-Select2, djangocms-column, djangocms-file, djangocms-flash, djangocms-googlemap, djangocms-inherit, pytz, tzlocal, djangocms-installer, djangocms-link, djangocms-picture, djangocms-style, djangocms-teaser, Pillow, djangocms-text-ckeditor, djangocms-video, polls-master, South
Found existing installation: Django 1.7.4
Not uninstalling Django at /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages, outside environment /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Envs/djangocms
Running setup.py develop for polls-master
Successfully installed Django-1.7.4 Django-Select2-4.3.1 Pillow-2.8.0 South-1.0.2 dj-database-url-0.3.0 django-classy-tags-0.6.2 django-cms-3.1.2 django-reversion-1.8.5 django-sekizai-0.8.2 django-treebeard-3.0 djangocms-admin-style-0.2.7 djangocms-column-1.5 djangocms-file-0.1 djangocms-flash-0.2.0 djangocms-googlemap-0.2 djangocms-inherit-0.1 djangocms-installer-0.7.8 djangocms-link-1.6.2 djangocms-picture-0.1 djangocms-style-1.5 djangocms-teaser-0.1 djangocms-text-ckeditor-2.5.2 djangocms-video-0.1 html5lib-0.99999 polls-master pytz-2015.4 tzlocal-1.2
您已安装Django 1.7.4
:
找到现有安装:Django 1.7.4 。我相信这就是没有安装Django 1.6.11
的原因。因此输出消息:不在/ Volumes / Data /...卸载Django。
答案 1 :(得分:0)
IRC的某个人向我解释了这个问题:
它与我的 sys.path 和我的 $ PYTHONPATH 有关: 我在 $ PYTHONPATH 中添加了主要的python路径(标准路径,不使用virtualenv),所以我的 $ PYTHONPATH 被添加到我的 sys.path < / strong>作为前缀,来自virtualenv外部的django是在内部导入之前导入的。
我只需要在我的〜/ .zshrc 中取消 $ PYTHONPATH ,它就像魅力一样!