Python: 本地安装与虚拟环境性能差异显着

Python: significant difference in performance between local installation and virtual environment

我发现我的本地 Python (2.7) 和 virtual environment(在同一台机器上)在性能上存在显着差异。

我测试了以下脚本:

import numpy as np
import time

A = np.random.rand(500, 3000)
B = np.random.rand(5000, 3000)

tic = time.time()
p = np.dot(A, B.T)
toc = time.time()
print toc - tic

它在本地环境中快了约 20 倍。

可能是什么原因? (也许有一个加速矢量化操作的包安装在我的本地 Python 而不是在虚拟环境中?)

提前感谢您的任何建议。

根据@BiRico 的建议,我使用以下命令检查了线性代数库(如 BLAS 和 LAPACK)的版本:

python -c 'import numpy; numpy.show_config()'

很惊讶,我没有安装任何这些。