安装django-fcm时Django会更新。如何安装django-fcm而不更新django

时间:2017-01-03 05:30:13

标签: django pip virtualenv

我的django版本是1.8.3。我读它支持django-fcm。 我尝试使用

django-fcm中安装virtual environment
pip install django-fcm

遗憾地运行此命令将我现有的django版本替换为1.10,将djangorestframework从3.2.2替换为3.5.2

这是日志

pip install django-fcm
Requirement already satisfied: django-fcm in /home/sudheer/virtualenvs/mediaone/lib/python2.7/site-packages
Collecting djangorestframework>=3.3.2 (from django-fcm)
  Using cached djangorestframework-3.5.3-py2.py3-none-any.whl
Collecting django>=1.9 (from django-fcm)
  Using cached Django-1.10.4-py2.py3-none-any.whl
Collecting pytz>=2015.7 (from django-fcm)
  Using cached pytz-2016.10-py2.py3-none-any.whl
Collecting requests>=2.9.1 (from django-fcm)
  Using cached requests-2.12.4-py2.py3-none-any.whl
Installing collected packages: djangorestframework, django, pytz, requests
  Found existing installation: djangorestframework 3.2.2
    Uninstalling djangorestframework-3.2.2:
      Successfully uninstalled djangorestframework-3.2.2
  Found existing installation: Django 1.8.3
    Uninstalling Django-1.8.3:
      Successfully uninstalled Django-1.8.3
  Found existing installation: pytz 2015.4
    Uninstalling pytz-2015.4:
      Successfully uninstalled pytz-2015.4
  Found existing installation: requests 2.7.0
    Uninstalling requests-2.7.0:
      Successfully uninstalled requests-2.7.0
Successfully installed django-1.10.4 djangorestframework-3.5.3 pytz-2016.10 requests-2.12.4

有没有办法防止这种情况发生。 我只想安装django-fcm

2 个答案:

答案 0 :(得分:1)

您可以使用pip install -h

这个可用选项

pip有一个--no-deps选项。

- no-deps 不要安装软件包依赖项。

答案 1 :(得分:1)

或者,将应用程序的依赖项放在需求文件中,以便列出所需的特定版本。如果您想更新一个软件包,pip将会知道您指定的其他软件包,而不是升级软件包。

requirements.txt

django==1.8.3
djangorestframework==3.2.2
django-fcm==<some version>

然后安装

pip install -r requirements.txt