我在 Windows、Linux 以及最近在 OsX 上使用 Python 已有 20 年。但是,由于 MS 迫使我从 Windows 8 切换到 Windows 10,在我的 32 GB Quadcore 上,首次运行 Python 程序所需的时间从几分之一秒减少到 5-10 秒。
有谁知道是什么原因造成的以及如何让它再次变快?
最佳答案
对我来说,浪费时间的是所有进口商品。如果您有任何使用 -e
安装的软件包,它们的加载速度会特别慢。要测量时间,您可以这样做...
import time
t0=time.time()
# put all your imports here
import numpy as np
import logging
import mystuff
print('IMPORT TIME =', time.time()-t0)
关于python - 为什么在 Windows 10 下启动 python 如此缓慢,以及如何加快速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53203963/