Python 3.7 错误:AttributeError:模块“子进程”没有属性“运行”

Vee*_*lur 1 python subprocess python-3.x python-3.7

我正在使用 python 3.7 在 pycharm 中运行以下代码。但出现此错误。

import subprocess
subprocess.run('dir', shell=True)
Run Code Online (Sandbox Code Playgroud)

错误消息:AttributeError:模块“子进程”没有属性“运行”

lll*_*101 5

你的程序的文件名也是subprocess.py吗?如果是这样,请更改它并再次运行以确认