OSError:[WinError 1450]系统资源不足,无法通过Anaconda在Python中使用Selenium完成请求的服务 [英] OSError: [WinError 1450] Insufficient system resources exist to complete the requested service using Selenium in Python through Anaconda

查看:1665
本文介绍了OSError:[WinError 1450]系统资源不足,无法通过Anaconda在Python中使用Selenium完成请求的服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的一个月中,我一直使用Windows任务计划程序运行相同的python脚本,然后突然该脚本运行为Insufficient Resources错误(请参见下文).当我尝试运行程序时,我的CPU和RAM处于正常水平(CPU小于10%,RAM小于20%).我将虚拟机上的CPU和RAM都增加了三倍,但仍然收到相同的错误.

I've been running the same python script using windows task scheduler for the past month, then all of a sudden the script runs into an Insufficient Resources error (see below). My CPU and RAM are at normal levels (CPU is <10% and RAM is <20%) when I try to run the program. I have quadrupled both the CPU and RAM on the virtual machine, but I still get the same error.

这是我要运行的代码:

from selenium import webdriver
browser = webdriver.Firefox()

这是我得到的错误:

Traceback (most recent call last):
  File "Desktop\Scripts\Selenium_file.py", line 34, in <module>
    browser = webdriver.Firefox()
  File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__
    self.service.start()
  File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    stdin=PIPE)
  File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1155, in _execute_child
    startupinfo)
OSError: [WinError 1450] Insufficient system resources exist to complete the requested service

我已经卸载并重新安装了selenium,并得到了相同的错误.

I've uninstalled and reinstalled selenium and get the same error.

我已经检查了COMSPEC变量,例如

I've checked the COMSPEC variable like this post suggested:

>>> import os
>>> os.environ['COMSPEC']
'C:\\Windows\\system32\\cmd.exe'

我还使用psutil检查了CPU和内存:

I've also checked the cpu and memory using psutil:

>>> import psutil
>>> psutil.cpu_times()
scputimes(user=237.75, system=402.5625, idle=7884.859375, interrupt=2.421875, dpc=3.71875)
>>> psutil.virtual_memory()
svmem(total=17179398144, available=14275997696, percent=16.9, used=2903400448, free=14275997696)

推荐答案

此错误消息...

OSError: [WinError 1450] Insufficient system resources exist to complete the requested service

...表示 Python客户端无法完成所请求的特定服务.

...implies that the Python Client was unable to complete a particular requested service.

该错误似乎与 Selenium 无关,但涉及到 Python客户端和底层的操作系统.

This error doesn't seem to be Selenium related but involves the Python Client and the underlying Operating System.

但是,按照" Windows 10 "操作系统上的Windows长时间出现通常会在Windows 上发生错误,当您插入USB驱动器时,或尝试启动某些.exe文件(例如Chrome浏览器,iTunes,Microsoft Edge等)时,计算机将变得死机或卡死. PC重新启动后,该错误可能再次发生并停止您的计算.

However, as per "Insufficient System Resources Exist to Complete the Requested Service" Error on Windows often occurs on the Windows 10 OS when you leave your computer on for a long time, when you plug into a USB drive, or when you're trying to launch some .exe files like the Chrome browser, iTunes, Microsoft Edge, etc. Then the computer will get freezing or stuttering. After a PC reboot, the error may happen again and stop your computing.

两种最常用的方法如下:

The two most frequently used approach are as follows:

  • 如果Windows 10没有足够的内部内存资源来创建系统映像,那么您将陷于系统错误系统资源不足,无法完成请求的服务".修改注册表可能会减轻痛苦.
  • 使用Windows快捷键 Win + R 打开运行.
  • 键入regedit.
  • 按Enter键.
  • 扩展子项的条目:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer.
  • 突出显示LanmanServer,然后右键单击右窗格中的空白区域.
  • 选择新值和DWORD(32位)值.
  • 将新条目命名为maxworkitems.
  • 双击新条目,然后在数值数据"框中键入1024.
  • 单击确定. (注意:如果您的计算机内存不足512M,请在框中键入256.)
  • If Windows 10 has no enough inner memory resources to create the system image, then you will get stuck on the system error "insufficient system resources exist to complete the requested service". A registry modification could release the pain.
  • Use Windows shortcut keys Win + R to open the Run.
  • Type into regedit.
  • Hit the Enter.
  • Expand the entry for the subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer.
  • Highlight the LanmanServer and right-click the blank area on the right pane.
  • Select the New and DWORD (32-bit) Value.
  • Name the new entry as maxworkitems.
  • Double-click the new entry and type 1024 into the Value data box.
  • Click the OK. (Note: If your computer memory storage is less than 512M, type 256 into the box.)

  • 转到子项:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management.
  • 突出显示内存管理.
  • 在右侧,右键单击空白区域以创建新的DWORD(32位)值.
  • 将新条目命名为PoolUsageMaximum.
  • 将数值"数据更改为60,然后选择十进制"选项.
  • 单击确定.
  • Go to the subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management.
  • Highlight the Memory Management.
  • On the right side, right-click the blank area to create a new DWORD (32-bit) Value.
  • Name the new entry as PoolUsageMaximum.
  • Change the Value data to 60 and choose the Decimal option.
  • Click the OK.

  • 重新启动计算机.
  • 注意:注册表编辑器是一个存储重要Windows数据的数据库.最好在进行任何修改之前先备份注册表,以防发生其他严重的系统错误,例如黑屏问题,启动循环问题,系统找不到指定的文件"错误等.
  • Restart the computer.
  • Note: Registry Editor is a database storing important Windows data. You'd better backup registry before any modification in case other serious system errors occur, such as black screen problem, boot loop issue, "system cannot find the file specified" error, etc.
  • 故障磁盘驱动器可能会导致错误系统资源不足,无法完成请求的服务"和其他存储问题,例如高内存使用问题,内存泄漏问题,100%磁盘使用问题,等等.因此有必要进行扫描以检查磁盘.
  • 在Windows 10上打开此PC.
  • 右键单击C:驱动器,然后选择属性".
  • 转到工具"标签.
  • 单击检查"按钮.
  • 单击扫描驱动器.
  • The faulty disk drive can result in the error "insufficient system resources exist to complete the requested service" and other storage problems, such as high memory usage issue, memory leak issue, 100% disk usage problem, etc. So it may be necessary to take a scan to check the disk.
  • Open This PC on Windows 10.
  • Right-click the C: drive and select Properties.
  • Go to the Tools tab.
  • Click the Check button.
  • Click the Scan drive.

  • 然后Windows 10将开始检查.如果发现错误,则可以按照屏幕上的说明进行修复.
  • 之后,您还可以单击C:驱动器属性上的优化"按钮来优化驱动器.
  • Then Windows 10 will start checking. If errors are found, you can follow the on-screen instructions to fix them.
  • After that, you can also click the Optimize button on the C: drive Properties to optimize the drive.

这篇关于OSError:[WinError 1450]系统资源不足,无法通过Anaconda在Python中使用Selenium完成请求的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆