Python - Limit cpu usage for a script

前端 未结 1 1645
Happy的楠姐
Happy的楠姐 2021-01-13 03:03

Is it possible for a python script to limit the cpu power allocated to it.
Right now, I have a script (using only one core) that i

相关标签:
1条回答
  • 2021-01-13 03:36

    Maybe try Python's "resource" package ?

    The resource package is basically a wraparound of "setrlimit" in UNIX. So you can set constrains for CPU/Memory usage, etc.

    More about "setrlimit" in UNIX

    Thanks @Stephane for pointing it out, this is actually my first answer ever.

    0 讨论(0)
提交回复
热议问题