简体   繁体   中英

Python import packages under chroot environment

I am writing some Python script and I would like to use os.chroot to execute some code under chroot environment. The problem is after calling os.chroot , paths in sys.path lie outside of the chroot jail, so import won't work. What's the best way to do it?

您可以在os.chroot之前进行所有必要的导入。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM