为什么在Windows 10下启动python如此缓慢,以及如何加快速度



我在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)

最新更新