How to install subprocess module for python?

avasin

pip is not able to find this module, as well as me on pypi website. Could you please tell me the secret, how to install it?

I need the module to spawn new shell process via subprocess.call. I have seen a lot of examples, where people use import subprocess, but no one shows how it was installed.

Error, that i got (just in case i've lost my mind and does not understand what is going on):

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
David Heffernan

There is no need to install this module in Python 2.7. It is a standard module that is built in.

The documentation shows that it was added to the library for Python version 2.4. It's been with us for a long time now.


The error that you show in your question update is nothing more prosaic than a file not found error. Likely the executable file that you are attempting to call Popen on cannot be found.

That traceback indicates that subprocess is installed and has been imported. The problem is simply that the call to subprocess.call('py.test') is failing.


For future reference, this is the type of traceback you encounter when attempting to import a module that has not been installed:

>>> import foo
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named foo

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How to import liblas module in Python?

来自分类Dev

How to install the perl module DBD::Sybase on Unix (Mac OSX)?

来自分类Dev

xarg与python multiprocessing + subprocess的性能

来自分类Dev

Python subprocess.poll()问题

来自分类Dev

Python subprocess.call问题

来自分类Dev

Python:subprocess.call 注入

来自分类Dev

How to find or install themes tkinter ttk for Python

来自分类Dev

How can I install a Node.js module under $HOME/bin

来自分类Dev

Python subprocess.popen()无需等待

来自分类Dev

Python subprocess.Popen()等待完成

来自分类Dev

解析Python subprocess.check_output()

来自分类Dev

Error calling subprocess on python when redirecting stdout

来自分类Dev

Redirecting stdout to stderr in Python's subprocess/Popen

来自分类Dev

unable to provide password to a process with subprocess [python]

来自分类Dev

Python Subprocess.Popen和rdesktop

来自分类Dev

用Python替换subprocess.PIPE?

来自分类Dev

解析Python中subprocess.call()的输出

来自分类Dev

Python Subprocess.Popen属性错误?

来自分类Dev

python subprocess.call参数问题

来自分类Dev

subprocess.poll的Python语法错误

来自分类Dev

Python subprocess.popen错误的pid

来自分类Dev

用Python替代subprocess.PIPE?

来自分类Dev

subprocess.Popen中的Python重定向

来自分类Dev

使用 subprocess.call 的 Python 执行顺序

来自分类Dev

Python - subprocess.Popen 不返回输出

来自分类Dev

在 Python 中使用 g++ 和 subprocess

来自分类Dev

使用 subprocess.call 执行 python 文件?

来自分类Dev

How to install Boost.Python on Windows 7 in order to install a python package?

来自分类Dev

什么是Powershell中的Install-Module命令?