PyPy Sandbox:无法导入rpython modu

2024-04-27 03:42:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用PyPy创建一个服务器端沙盒,对我的文件系统的访问受到限制。我在Ubuntu12.04 64位机器上工作,一直试图从这里安装PyPy的完整源代码:http://pypy.org/download.html#sandboxed-version(向下滚动到“从源代码构建”部分)。在

我的问题是每当我尝试运行pypy_交互.py(位于pypy/pypy/sandbox中),我得到以下错误:

重要错误:没有命名的模块rpython.translator.sandbox.sandlib公司

无法导入的模块具有以下路径:pypy/rpython/translator/sandbox/sandlib.py. pypy的内容_交互.py具体如下:

import sys, os
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '..\
', '..', '..')))
from rpython.translator.sandbox.sandlib import SimpleIOSandboxedProc
from rpython.translator.sandbox.sandlib import VirtualizedSandboxedProc
from rpython.translator.sandbox.vfs import Dir, RealDir, RealFile
import pypy
LIB_ROOT = os.path.dirname(os.path.dirname(pypy.__file__))

我觉得这是一个非常简单的修复方法——我几天前才开始学习Python,所以我不太确定如何解决这个问题/还不太了解导入。有什么建议吗?非常感谢。在


Tags: 模块pathfrompyimport源代码os错误