python打包后启动很慢_在Windows 7上启动Python很慢

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.

From a Bash prompt (Git bash on Windows):

$ time python3 -c "pass"

returns in 0.614s on Windows and 0.036s on Linux

When packages are loaded the situation gets worse:

$ time python3 -c "import matplotlib"

returns in 6.01s on Windows and 0.189s on Linux

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?

edit:

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']

Update:

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.

Correction:

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.

解决方案

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).

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值