简体   繁体   English

在开发时,为什么`pip install .`要比`python setup.py install`慢得多?

[英]When developing, why is `pip install .` so much slower than `python setup.py install`?

While I'm developing a python package, a common loop for me is to edit a few files, then reinstall the package in my virtual environment and re-run tests: 在开发python软件包时,对我而言,常见的循环是编辑一些文件,然后在虚拟环境中重新安装该软件包并重新运行测试:

python setup.py install && pytest tests

The python setup.py install part runs in 0.696 seconds. python setup.py install部分在0.696秒内运行。

I feel like I should be using pip for this, which also works but is MUCH slower than the previous command: 我觉得我应该为此使用pip ,它也可以工作,但比以前的命令要慢得多:

pip install . && pytest tests

Here pip install . 在这里pip install . runs in 42.006 seconds. 运行时间为42.006秒。

Is there any way to speed up a local development install of pip install . 有什么办法可以加快本地开发pip install . so it's on the order of python setup.py install ? 所以它在python setup.py install的顺序上?

It is slow because it makes a full copy of the entire directory, including possibly big hidden dirs like .git, .hg, .idea, .vagrant etc. 这很慢,因为它会复制整个目录,包括可能很大的隐藏目录,例如.git,.hg,.idea,.vagrant等。

See this open issue: https://github.com/pypa/pip/issues/2195 看到这个开放的问题: https : //github.com/pypa/pip/issues/2195

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

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