用Idle运行Python脚本的时候发现如下错误:

Traceback (most recent call last):
  File "D:\Python\Python36-32\lib\site-packages\selenium-3.4.3-py3.6.egg\selenium\webdriver\common\service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "D:\Python\Python36-32\lib\subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "D:\Python\Python36-32\lib\subprocess.py", line 990, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

后来在stackoverflow上找到如下解决办法:

In Windows , to use echo in subprocess, you would need to use shell=True . This is because echo is not a separate executable, but rather a built-in command for the windows command line. Example -
在windows 在子进程中使用echo,需要设置 shell =True,因为 echo 不是单独的命令,而是window CMD 内置的命令

process1 = subprocess.Popen(command1,stdout=subprocess.PIPE,shell=True)

Also, please do note, you should only use shell=True when absolutely necessary (as in this case , to use echo in windows in subprocess).

并且,需要注意,只有在绝对需要的情况下才使用shell=True

找到 subprocess.py脚本,将对应行加上shell=true 参数。

FileNotFoundError: [WinError 2] 系统找不到指定的文件的更多相关文章

  1. python FileNotFoundError: [WinError 2] 系统找不到指定的文件。

    D:\Test\TestSWP\Scripts\python.exe D:/Test/SWP/TestSWP/chorme/chorme.pyTraceback (most recent call l ...

  2. 路径不对 导致FileNotFoundError: [WinError 2] 系统找不到指定的文件, 问题解决办法

    执行python + selenium 代码 from selenium import webdriver driver = webdriver.Chrome("D:\AutoConf\bi ...

  3. 在使用selenium时出现FileNotFoundError: [WinError 2] 系统找不到指定的文件。

    今天在使用selenium出现这样的错: Traceback (most recent call last): File "E:\python\lib\site-packages\selen ...

  4. FileNotFoundError: [WinError 2] 系统找不到指定的文件。 解决方案

    用Idle运行Python脚本的时候发现如下错误: Traceback (most recent call last): File "C:\Users\DangKai\Desktop\pyt ...

  5. pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path && FileNotFoundError: [WinError 2] 系统找不到指定的文件。

    C:\Users\k\Desktop\test>python test.py Traceback (most recent call last): File , in run_tesseract ...

  6. 转换文件格式遭遇 FileNotFoundError:[WinError 2]系统找不到指定的文件

    重启试试

  7. TextClip构造方法报OSError:MoviePy creation of None failed because of the following [WinError 2]系统找不到指定的文件

    ☞ ░ 前往老猿Python博文目录 ░ 在使用moviepy的构造方法创建实例时报错: "C:\Program Files\Python37\python.exe" F:/stu ...

  8. [Python学习]错误篇二:切换当前工作目录时出错——FileNotFoundError: [WinError 3] 系统找不到指定的路径

    REFERENCE:<Head First Python> ID:我的第二篇[Python学习] BIRTHDAY:2019.7.13 EXPERIENCE_SHARING:解决切换当前工 ...

  9. building '_mysql' extension error: [WinError 2] 系统找不到指定的文件。

    D:\4yanjiiu\APIzidong\MySQL-python-1.2.5>py running install running bdist_egg running egg_info wr ...

随机推荐

  1. C++Review1_多态和虚函数

    继承是实现多态的基础.虚函数是实现多态的方法.虚函数.多态.继承都是紧密相关的概念.而继承是所有概念的基础: 多态:简单来讲就是接口一样,实现多样.多态是指通过基类的指针或者引用,在运行时动态调用实际 ...

  2. [wireshark] ip filter

    查ip 时,使用 ip==10.224.37.18 发现无效 使用 ip.dst, 查到了 Match destination: ip.dst == x.x.x.x Match source: ip. ...

  3. .NET Core开发的iNeuOS工业互联平台,升级四大特性:配置数据接口、图元绑定数据、预警配置和自定义菜单

    目       录 1.      概述... 2 2.      演示信息... 2 3.      iNeuView(Web组态)配置数据接口... 2 4.      iNeuView(Web组 ...

  4. 20191107-8 beta week 2/2 Scrum立会报告+燃尽图 07

    此作业要求参见 http://edu.cnblogs.com/campus/nenu/2019fall/homework/9960 小组名称:“组长”组 组长:杨天宇 组员:魏新,罗杨美慧,王歆瑶,梅 ...

  5. 使用这些idea插件让开发效率提高5倍

    idea 有很多非常好用的插件,用好了这些插件能够极大的提高开发效率 插件用的好,bug 就追不上了我

  6. js滑动导航栏点击后居中效果

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. linux防火墙之iptables

    linux防火墙之iptables 1.1.1 关于iptables简介 IPTABLES 是与最新的 3.5 版本 Linux 内核集成的 IP 信息包过滤系统.如果 Linux 系统连接到因特网或 ...

  8. 虚拟机安装LEDE旁路由实现软路由功能

    如何在虚拟上安装LEDE软路由,接下来我们一步一步操作. 1.首先到https://firmware.koolshare.cn/ 下载虚拟机下专用盘如图标记均可 2.虚拟机创建 选择下载好的文件 保持 ...

  9. Oracle基础之保留字和关键字

    Oracle基础之保留字和关键字 在Oracle之中,有分为保留字和关键字,所谓关键字就是Oracle中有实际意义的,而保留字(比如DESC.ORDER等等)是Oracle中不能随便使用的,比如不能随 ...

  10. ArcGIS Server 动态图层发布调用图解

    目录 1 前言 1.1 简介 1.2 适用场景 2 动态图层 2.1 共享地图服务 2.2 动态工作空间添加 2.2.1 企业级数据库 2.2.2 shapefile文件夹 2.2.3 栅格文件夹 2 ...