python resource模块使用

Posted 邱明成

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python resource模块使用相关的知识,希望对你有一定的参考价值。

import os
import psutil
import resource
import subprocess

def preexec_fn():
    pid os.getpid()
    ps = psutil.Process(pid)
    ps.set_nice(10)
    resource.setrlimit(resource.RLIMIT_CPU(11))

print"mother pid"os.getpid()
subprocess.Popen(["./cpuhog.sh"], preexec_fn=preexec_fn)
p.wait()
print"mother still alive with pid"os.getpid()

以上是关于python resource模块使用的主要内容,如果未能解决你的问题,请参考以下文章

如何为python安装不同版本的模块

如何通过代码获取 python 模块的版本号? [复制]

没有名为“pkg_resources”的模块

vue-cli——vue-resource登录注册实例

用于渲染图像的 Grails Resources 插件、模块和 <r:img>?

$resources