FileNotFoundError: [WinError 2] 系统找不到指定的文件。 解决方案
用Idle运行Python脚本的时候发现如下错误:
Traceback (most recent call last):
File "C:\Users\DangKai\Desktop\pythonUI-unittest-selenium\venv\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "D:\Software\Python37\lib\subprocess.py", line 756, in init
restore_signals, start_new_session)
File "D:\Software\Python37\lib\subprocess.py", line 1155, 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] 系统找不到指定的文件。 解决方案的更多相关文章
- python FileNotFoundError: [WinError 2] 系统找不到指定的文件。
D:\Test\TestSWP\Scripts\python.exe D:/Test/SWP/TestSWP/chorme/chorme.pyTraceback (most recent call l ...
- 路径不对 导致FileNotFoundError: [WinError 2] 系统找不到指定的文件, 问题解决办法
执行python + selenium 代码 from selenium import webdriver driver = webdriver.Chrome("D:\AutoConf\bi ...
- 在使用selenium时出现FileNotFoundError: [WinError 2] 系统找不到指定的文件。
今天在使用selenium出现这样的错: Traceback (most recent call last): File "E:\python\lib\site-packages\selen ...
- FileNotFoundError: [WinError 2] 系统找不到指定的文件
用Idle运行Python脚本的时候发现如下错误: Traceback (most recent call last): File "D:\Python\Python36-32\lib\s ...
- 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 ...
- 转换文件格式遭遇 FileNotFoundError:[WinError 2]系统找不到指定的文件
重启试试
- TextClip构造方法报OSError:MoviePy creation of None failed because of the following [WinError 2]系统找不到指定的文件
☞ ░ 前往老猿Python博文目录 ░ 在使用moviepy的构造方法创建实例时报错: "C:\Program Files\Python37\python.exe" F:/stu ...
- [Python学习]错误篇二:切换当前工作目录时出错——FileNotFoundError: [WinError 3] 系统找不到指定的路径
REFERENCE:<Head First Python> ID:我的第二篇[Python学习] BIRTHDAY:2019.7.13 EXPERIENCE_SHARING:解决切换当前工 ...
- building '_mysql' extension error: [WinError 2] 系统找不到指定的文件。
D:\4yanjiiu\APIzidong\MySQL-python-1.2.5>py running install running bdist_egg running egg_info wr ...
随机推荐
- web api(基于NFine框架) 中接口跳转数据格式错误解决方案
using NFine.Code; using NFine.Domain; using System.Web.Http; using Newtonsoft.Json; namespace Api.Co ...
- Windows 10 WSL 2.0安装并运行Docker
在Windows 10 2004版本,微软更新WSL到了2.0,WSL 2.0已经拥有了完整的Linux内核!今天来测试一下,是否可以安装docker! 一.开启WSL 以管理员运行Powershe ...
- Bestcoder Round8
4989Summary 既然用C++了就偷懒直接用STL大法了 #include<iostream> #include<algorithm> #include<vecto ...
- Vmaware克隆虚拟机后无法上网
问题: 使用快照克隆了一台虚拟机 打开后发现无法上网,ifconfig查看状态 解决办法: 1.点击右下角的网络设置,点击设置,查看mac地址与文件/etc/udev/rules.d/70-persi ...
- 大文件上传、断点续传、秒传、beego、vue
大文件上传 0.项目源码地址 源码地址 :https://github.com/zhuchangwu/large-file-upload 它是个demo,仅供参考 前端基于 vue-simple-up ...
- Code Walkthroughs DataStream API
上级:https://www.cnblogs.com/hackerxiaoyon/p/12747387.html DataStream API DataStreamApi 提供了健壮,有状态的流应用, ...
- pick靶场-sql注入
甲.数字型注入 数字型注入一般提交值没有引号,所以直接在后面构造语句就可以了. 抓包查看 构造语句 提交后 该数据库表内容被爆出来了. 乙.字符型注入 首先我们要知道一点,字符串在数据库中提交是需要用 ...
- MTPuTTy使用
在开发过程中我们常常会有连接远程 lunix 服务器的需求,这个时候我们需要一个工具来帮助我们做这件事,而这类工具就是远程连接工具.常见的工具有XShell,SecureCRT,Putty等.这里我选 ...
- Typography convention
1 h1 Chapter title centered,number three in bold,used ##. 1.1 h2 The chapter is a section, and the s ...
- 如何针对Thymeleaf模板抽取公共页面
对于公共页面(导航栏nav.页头head.页尾footer)的抽取有三种方式: 1)基于iframe进行抽取,这种方式很有效,但比较老了,另外为了页面的自适应性,还得做不少工作: ...