【发布时间】:2013-08-12 09:42:43
【问题描述】:
当我在 Subprocess 模块中使用 check_output 时,Python shell 出现以下输出错误:
AttributeError: 'module' 对象没有属性 'check_output'
代码:
target = raw_input("IP: ")
port = subprocess.check_output(["python", "portscanner.py", target ])
我使用 Python 2.7。感谢您的解决方案!
【问题讨论】:
-
print subprocess.__file__说的是模块的位置?此外,.check_output()仅在 Python 2.7 中添加,因此请确保您运行的是正确的 Python 版本。
标签: python python-2.7 subprocess