`'pip wheel .` 比 'setup.py bdist_wheel` 慢很多

`'pip wheel .` much slower than 'setup.py bdist_wheel`

this setup.py (not yet committed to the root of this project) Python 2.7 , pip wheel . 需要将近 20 分钟

$:~/projects/cfgov-refresh$ time pip wheel .                                                                                                     
   Processing /Users/karchnerr/projects/cfgov-refresh
   Building wheels for collected packages: cfgov
   Running setup.py bdist_wheel for cfgov ... done
   Stored in directory: /Users/karchnerr/projects/cfgov-refresh
   Successfully built cfgov

    real    19m50.061s
    user    0m29.641s
    sys     1m21.651s

setup.py bdist_wheel 只需几秒钟。

rk@:~/projects/cfgov-refresh$ time python setup.py bdist_wheel
    [... ommited a bunch of noise ...]
    real    0m2.575s
    user    0m0.586s
    sys     0m0.309s

知道是什么造成了如此大的差异吗?有什么我应该做的不同的事情吗?


使用 moreutils 的 ts 命令,我可以看到在 pip 开始处理之前花费了大量时间 setup.py

[2017-01-17 15:41:36] Processing /Users/karchnerr/projects/cfgov-refresh
[2017-01-17 15:54:42]   Running setup.py     (path:/private/var/folders/_f/3lrtcs492pnbf6zcql9t0n380000gp/T/pip-p6TG9c-    build/setup.py) egg_info for package from file:///Users/karchnerr/projects/cfgov-refresh

这是我想出的:

  • pip wheel 坚持将整个项目复制到临时目录中,使用 shutil.copytree
  • 复制树很慢
  • 这个 repo 有 lot 个文件。