Python FileNotFoundError: [WinError 2] 系统找不到指定的文件。
来源:互联网 发布:求锥度计算软件 编辑:程序博客网 时间:2024/04/27 23:16
用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 参数。
该问题解决。
阅读全文
2 0
- Python FileNotFoundError: [WinError 2] 系统找不到指定的文件。
- _winapi Createprocess FileNotFoundError: [WinError 2] 系统找不到指定的文件
- Python爬虫——FileNotFoundError: [WinError 2] 系统找不到指定的文件。
- 使用pyspark时报错--FileNotFoundError: [WinError 2] 系统找不到指定的文件。
- error:[WinError 2] 系统找不到指定文件
- python,[WinError 3] 系统找不到指定的路径
- Sublime Text FileNotFoundError(2, '系统找不到指定的文件。', None, 2)
- sublime text 编译时提示[WinError 2] 系统找不到指定的文件。
- 使用pytesseract出现错误:“[WinError 2] 系统找不到指定的文件
- building '_mysql' extension error: [WinError 2] 系统找不到指定的文件
- OSError: [WinError 126] 找不到指定的模块。
- vcomp140.dll缺失 OSError: [WinError 126] 找不到指定的模块。
- 系统找不到指定的文件
- 系统找不到指定的文件
- 系统找不到指定的文件
- Python pytesseract WinError 2
- CreateProcess error=2, 系统找不到指定的文件
- Sublime突然运行不了python文件_提示FileNotFoundError(2,'')
- Java机器学习库ML之四模型训练和预测示例
- 数据存储之文件存储
- 欢迎使用CSDN-markdown编辑器
- spring配置文件详解
- C# 中的委托和事件 ——张子阳
- Python FileNotFoundError: [WinError 2] 系统找不到指定的文件。
- 华院数据 学习 D04
- Spring boot(18) spring mvc请求参数的校验和处理规范
- UIDatePicker时间选择器
- 面向对象的思想
- Angularjs中select 的ng-repeat 和 ng-options 用法和获取选取值
- 人工神经网络中的activation function的作用
- 【转载】----Linux下使用ext3grep恢复目录及文件指南(ext3文件系统)
- 微服务架构【1.起源与定义】