在Windows 7上启动Python的速度非常慢 [英] Python is very slow to start on Windows 7

查看:223
本文介绍了在Windows 7上启动Python的速度非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 7机器上,Python加载所需的时间比在VM(在同一硬件的Windows内部)上运行的Ubuntu 14.04的加载时间长17倍. Anaconda3发行版在Windows和Ubuntu默认python3.4上使用.

Python takes 17 times longer to load on my Windows 7 machine than Ubuntu 14.04 running on a VM (inside Windows on the same hardware). Anaconda3 distribution is used on Windows and Ubuntu default python3.4.

在Bash提示符下(在Windows上为Git bash):

From a Bash prompt (Git bash on Windows):

$ time python3 -c "pass"

在Windows上返回0.614秒,在Linux上返回0.036秒

returns in 0.614s on Windows and 0.036s on Linux

加载软件包时,情况变得更糟:

When packages are loaded the situation gets worse:

$ time python3 -c "import matplotlib"

在Windows上返回6.01秒,在Linux上返回0.189s

returns in 6.01s on Windows and 0.189s on Linux

Spyder在Windows上的加载时间高达51s,在Linux上的加载时间为1.5s.

Spyder takes a whopping 51s to load on Windows and 1.5s on Linux.

我没有运气来确定为什么我会遇到这种性能问题.有谁知道我接下来应该尝试什么?

I have not had any luck determining why I have this performance problems. Does anyone have any ideas what I should try next?

为什么python在Windows上这么慢?建议将其作为可能的副本,但我的性能差异要大得多,并且不能仅通过不同的库依赖关系和编译器来解释.在我看来,这与文件系统的差异有关.

Why is python so much slower on windows? has been suggested as a possible duplicate but my performance different is far greater and not explained simply by different library dependencies and compilers. This seems to me to be related to filesystem differences.

我怀疑防病毒按访问扫描,但是为了以防万一禁用了防病毒.

I had suspected antivirus on-access scans but disabled the antivirus just in case.

>>> sys.path

['', 'c:\\Anaconda3\\python34.zip', 'c:\\Anaconda3\\DLLs', 'c:\\Anaconda3\\lib', 'c:\\Anaconda3', 'c:\\Anaconda3\\lib\\site-packages', 'c:\\Anaconda3\\lib\\site-packages\\Sphinx-1.2.3-py3.4.egg', 'c:\\Anaconda3\\lib\\site-packages\\cryptography-0.8-py3.4-win-amd64.egg', 'c:\\Anaconda3\\lib\\site-packages\\nose-1.3.4-py3.4.egg', 'c:\\Anaconda3\\lib\\site-packages\\win32', 'c:\\Anaconda3\\lib\\site-packages\\win32\\lib', 'c:\\Anaconda3\\lib\\site-packages\\Pythonwin', 'c:\\Anaconda3\\lib\\site-packages\\setuptools-14.3-py3.4.egg']

更新:

在同一台PC上重新安装Windows 8.1 Pro可以解决此问题.重新安装所有应用程序和Anaconda3之后,Python性能是我所见过的最好的.不幸的是,此问题的根本原因仍然未知.

A fresh install of Windows 8.1 Pro on the same PC solved the problem. After reinstalling all applications and Anaconda3 Python performance is the best I have seen. Unfortunately the root cause of this issue is still unknown.

更正:

在我的IT部门安装了Sophos SafeGuard加密软件和MS Endpoint Protection之后,问题再次出现.与以前一样缓慢的启动.禁用额外的软件并不能解决问题,因此我们正在尝试在其他计算机上进行测试以跟踪问题.

After my IT dept installed Sophos SafeGuard encryption software and MS Endpoint Protection the problem returned. Same slow start as before. Disabling the extra software did not solve the problem so we are trying tests on other machines to trace the problem.

推荐答案

通过卸载Sophos SafeGuard解决了该问题.尽管由于我的公司在我每天访问的目录上使用此文件系统加密软件,但这并不是一个令人满意的解决方案.除了Python(显然还有Ruby)之外,我似乎没有其他任何性能问题.

The problem is solved by uninstalling Sophos SafeGuard. This is not really a satisfactory solution though since my company uses this filesystem encryption software on directories that I access daily. I have not seem any other performance problems except with Python (and apparently Ruby as well).

注意:Sophos SafeGuard不是不是防病毒软件.它是一个企业文件系统加密系统.奇怪的是,本地文件系统(例如安装Python的位置)明确未启用加密.

NOTE: Sophos SafeGuard is not antivirus software. It is an enterprise filesystem encryption system. The strange thing is that encryption is explicitly not enabled for local filesystems, such as where Python is installed.

这篇关于在Windows 7上启动Python的速度非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆