简体   繁体   English

Python:系统找不到使用subprocess.Popen指定的文件

[英]Python: the system cannot find the file specified using subprocess.Popen

The entirety of my script: 我的整个脚本:

#!/bin/env python

import subprocess
p = subprocess.Popen(["/bin/bash", "-i", "-c", "C:\\xampp\\xampp_stop.exe"])
stdout, stderr = p.communicate()

This results in: WindowsError: [Error 2] The system cannot find the file specified 结果导致: WindowsError: [Error 2] The system cannot find the file specified

However, C:\\xampp\\xampp_stop.exe does exist 但是, C:\\xampp\\xampp_stop.exe确实存在

Any suggestions? 有什么建议么? I'm new to python, so I suspect it's something very, very obvious. 我是python的新手,所以我怀疑它非常非常明显。

It's actually bash that the system can't find. 它实际上是bash ,该系统无法找到。 Windows doesn't come with bash . Windows不附带bash Remove it and its arguments and just call xampp_store.exe . 删除它及其参数,然后调用xampp_store.exe

#!/bin/env python

import subprocess
p = subprocess.Popen(["C:\\xampp\\xampp_stop.exe"])
stdout, stderr = p.communicate()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在python中调用subprocess.Popen时“系统找不到指定的文件” - "The system cannot find the file specified" when invoking subprocess.Popen in python 在Ubuntu上使用终端运行文件:os.system在subprocess.Popen找不到文件的地方起作用 - Running a file using terminal on Ubuntu: os.system is functional where subprocess.Popen cannot find the file 系统找不到使用子进程Popen指定的文件,只能在具有简单bat文件的桌面上工作 - The system cannot find the file specified using subprocess Popen and only works on desktop with simple bat files 系统找不到指定的文件python子进程 - system cannot find the specified file python subprocess 使用subprocess.popen和多个stdin配置系统:Python 2.7 - Using subprocess.popen with multiple stdin to configure system : Python 2.7 使用os.system和subprocess.Popen - Using os.system and subprocess.Popen Python subprocess.Popen() 找不到可执行文件 - Python subprocess.Popen() does not find executable 在 Python 中使用 subprocess.Popen() 通过 Java 程序打开文件 - Opening a File through a Java program using subprocess.Popen() in Python Python3 FileNotFoundError 与任何文件,使用 subprocess.popen() - Python3 FileNotFoundError with any file, using subprocess.popen() subprocess.Popen找不到文件? - subprocess.Popen can't find file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM