2015-07-04 96 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 –