ava*_*sin 11 python subprocess python-2.7
pip无法在pypi网站上找到这个模块,以及我.你能告诉我秘密,如何安装它?
我需要模块通过subprocess.call生成新的shell进程.我看过很多人们使用的例子,import subprocess但没有人展示它是如何安装的.
错误,我得到了(以防万一我失去理智,不明白发生了什么):
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\Alexander\Desktop\tests-runner>python run.py
Traceback (most recent call last):
File "run.py", line 165, in <module>
main()
File "run.py", line 27, in main
subprocess.call('py.test')
File "C:\Python27\lib\subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 710, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)
无需在Python 2.7中安装此模块.它是内置的标准模块.
该文件表明,它加入了Python版本2.4库.它已经和我们在一起了很长时间了.
您在问题更新中显示的错误并不比找不到文件错误更平淡.可能Popen无法找到您尝试调用的可执行文件.
该回溯表明subprocess已安装并已导入.问题只是呼叫subprocess.call('py.test')失败了.
为了将来参考,这是在尝试导入尚未安装的模块时遇到的回溯类型:
>>> import foo Traceback (most recent call last): File "", line 1, in ImportError: No module named foo