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

时间:2017-01-13 21:30:34

标签: python pip setuptools python-wheel

使用this setup.py(尚未提交到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

1 个答案:

答案 0 :(得分:1)

以下是我提出的建议:

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