Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python pip安装-r:仅安装新软件包_Python_Installation_Pip_Packages - Fatal编程技术网

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

Python pip安装-r:仅安装新软件包,python,installation,pip,packages,Python,Installation,Pip,Packages,假设我的requirements.txt文件是: diff-match-patch==20121119 django-braces==1.4.0 django-crispy-forms==1.4.0 我使用以下命令安装所有软件: pip install -r requirements.txt 现在让我们假设我添加了两个包: diff-match-patch==20121119 django-braces==1.4.0 django-crispy-forms==1.4.0 django-cus

假设我的
requirements.txt
文件是:

diff-match-patch==20121119
django-braces==1.4.0
django-crispy-forms==1.4.0
我使用以下命令安装所有软件:

pip install -r requirements.txt
现在让我们假设我添加了两个包:

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
如果我只想安装新软件包,即只安装最后两个软件包,我应该使用什么命令?
如果我再次运行命令
pip install-r requirements.txt
,它将下载并尝试安装所有内容,包括已经安装的软件包

如果您担心只升级某些软件包,可以使用
pip install-U
手动升级软件包


如果您担心的不是每次都新安装所有依赖项,那么不要担心。如果运行
pip install-r requirements.txt时没有
-U
(或
--upgrade
)标志,它将不会尝试更新以前安装的软件包,如中所述。

它不应该这样做。“当发出任何HTTP请求时,pip将首先检查其本地缓存,以确定是否为尚未过期的请求存储了合适的响应。如果有,则只返回该响应而不发出请求。”我猜这取决于缓存是否已过期。