当我运行python脚本时,即使python脚本中没有进程模块,进程数也会增加。
下面是我的python脚本中使用的python模块。
from __future__ import division
import os
import sys
import json
import Queue
import signal
import shutil
import logging
import datetime
import requests
import platform
import argparse
import threading
class Worker(threading.Thread):
def __init__(self)
threading.Thread.__init__(self)
self.workers = []
def run(self):
self.do_something() # file copy, symlink, etc...
def do_something(self):
...
shutil.copyfile(a, b)
os.symlink(c, d)
if __name__ == '__main__':
for i in range(10):
worker = Worker(item)
worker.start()
self.workers.append(worker)
而且,如何检查哪些模块/功能增加了处理数量。
尝试一次添加一个。我猜想罪魁祸首是threading