Python pypy沙箱罐';t导入时间,导入站点失败

Python pypy沙箱罐';t导入时间,导入站点失败,python,sandbox,pypy,Python,Sandbox,Pypy,我已经运行了rpythontranslate来创建一个pypy沙盒 ~/pypy-2.3.1-linux64/bin/pypy ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone 有几个警告,其中两个似乎涉及时间 长短不一的是,当转换完成时,当我运行沙箱时会出现以下输出: 'import site' failed Python 2.7.6 (32f35069a16d819b58c1b6efb17c44e3e53397b2,

我已经运行了rpythontranslate来创建一个pypy沙盒

~/pypy-2.3.1-linux64/bin/pypy ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone
有几个警告,其中两个似乎涉及时间

长短不一的是,当转换完成时,当我运行沙箱时会出现以下输出:

'import site' failed
Python 2.7.6 (32f35069a16d819b58c1b6efb17c44e3e53397b2, Jun 11 2014, 19:06:04)
[PyPy 2.3.1 with GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> 
然后导入时间也会失败:

>>>> import time
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named time
>>>> 
>>>>>导入时间
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为time的模块
>>>> 
这是沙箱的预期行为吗? 如果是这样的话,在沙盒流程中嵌入站点包等的正确做法是什么?
我希望使用pip安装在那个环境中,但是沙箱似乎使它变得非常困难。(基本上,我在尝试安装distribute.py时遇到了导入时间,因为它需要datetime,这需要时间)

刚刚遇到了同样的问题。解决方案是在构建
pypy-c
沙箱时包含
time
模块。在中,在生成时添加
--withmod time

pypy ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone --withmod-time
此处列出了其他可能的标志:

pypy ../../rpython/bin/rpython -O2 --sandbox targetpypystandalone --withmod-time