2015-07-04 100 views
4

Pypy有一个numpy分叉。如何在pypy沙盒中使用它?如何导入pypy沙盒中的numpy

沙盒提示'No module named numpy'。

但是,当我试图复制lib_pypy目录中的numpy库时,我收到了此错误消息。有没有办法在pypy 沙盒中导入numpy?

import numpyTraceback (most recent call last): 
File "<stdin>", line 1, in <module> 
File "/bin/lib_pypy/numpy/__init__.py", line 160, in <module> 
raise ImportError(msg) 
ImportError: Error importing numpy: you should not try to import numpy from 
    its source directory; please exit the numpy source tree, and relaunch 
    your python interpreter from there. 

回答

3

不能在沙盒PyPy中导入numpy,对不起。

这是几乎所有扩展模块的情况。 PyPy中的沙箱是概念的一个很好的证明,非常安全的imho,但它只是一个概念证明。这真的需要有人为此工作。在发生这种情况之前,它只能用于“玩具”的例子:大多不导入任何东西的程序(或者只是递归的纯Python模块)。

+1

@yonexer来自主要开发人员的权威答复。 – rth

+0

谢谢,@Armin Rigo – yonexer

+0

在FAQ中添加:http://pypy.readthedocs.org/en/latest/faq.html#module-xyz-does-not-work-in-the-sandboxed-pypy –