简体   繁体   English

pip install -r:仅安装新软件包

[英]pip install -r: install only new packages

Let's say my requirements.txt file is: 假设我的requirements.txt文件为:

diff-match-patch==20121119
django-braces==1.4.0
django-crispy-forms==1.4.0

I install all the software with the following command: 我使用以下命令安装所有软件:

pip install -r requirements.txt

Now let's say I add two packages: 现在假设我添加了两个包:

diff-match-patch==20121119
django-braces==1.4.0
django-crispy-forms==1.4.0
django-custom-user==0.4
django-import-export==0.2.3

If I want to install the new packages only, that is, only the last two ones, what command should I use? 如果仅安装新软件包,即仅安装最后两个软件包,应该使用什么命令? If I run again the command pip install -r requirements.txt , it's going to download and try to install everything, including the packages already installed! 如果我再次运行命令pip install -r requirements.txt ,它将下载并尝试安装所有内容,包括已经安装的软件包!

If you're worried about only upgrading certain packages, you can upgrade packages manually with pip install -U <package> . 如果您只担心升级某些软件包,可以使用pip install -U <package>手动升级软件包。

If your concern is not freshly installing all of your dependencies every time, don't worry. 如果您担心的不是每次都重新安装所有依赖项,请不必担心。 If you run pip install -r requirements.txt without the -U (or --upgrade ) flag, it won't try to update previously installed packages, as mentioned in this answer . 如果运行不带-U (或--upgrade )标志的pip install -r requirements.txt ,它将不会尝试更新以前安装的软件包,如本答案所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM