I need a unix terminal command that will boot a python interpreter without giving it access to import anything. I am aware that you can import os, and then change that path, but this would be counter productive, so I need to do it either on Python startup, or without importing anything in the python interprete开发者_运维知识库r.
Python does not have robust support for running untrusted code, but for a reasonable approximation, you can try this blog post. A more robust alternative would be to use Lua, JavaScript or TCL, all of which are carefully designed to run untrusted code in a crafted sandbox environment.
精彩评论