熊猫竹子 发表于 2022-11-28 12:59:27

问题;ImportError: DLL load failed while importing _greenlet: 找不到指定的模块

用playwright写智联招聘网的爬虫代码,并没有用到greenlet模块,运行时出现了下面错误提示,改怎么解决



C:\Users\AAA\PycharmProjects\pythonProject\venv\Scripts\python.exe C:\Users\AAA\PycharmProjects\pythonProject\爬虫\check.py
Traceback (most recent call last):
File "C:\Users\AAA\PycharmProjects\pythonProject\爬虫\check.py", line 1, in <module>
    from playwright.sync_api import sync_playwright, expect
File "C:\Users\AAA\PycharmProjects\pythonProject\venv\lib\site-packages\playwright\sync_api\__init__.py", line 25, in <module>
    import playwright.sync_api._generated
File "C:\Users\AAA\PycharmProjects\pythonProject\venv\lib\site-packages\playwright\sync_api\_generated.py", line 25, in <module>
    from playwright._impl._accessibility import Accessibility as AccessibilityImpl
File "C:\Users\AAA\PycharmProjects\pythonProject\venv\lib\site-packages\playwright\_impl\_accessibility.py", line 17, in <module>
    from playwright._impl._connection import Channel
File "C:\Users\AAA\PycharmProjects\pythonProject\venv\lib\site-packages\playwright\_impl\_connection.py", line 23, in <module>
    from greenlet import greenlet
File "C:\Users\AAA\PycharmProjects\pythonProject\venv\lib\site-packages\greenlet\__init__.py", line 29, in <module>
    from ._greenlet import _C_API # pylint:disable=no-name-in-module
ImportError: DLL load failed while importing _greenlet: 找不到指定的模块。

Process finished with exit code 1

suchocolate 发表于 2022-11-28 13:21:10

python版本多少,另外python的环境变量设置过了吧?

熊猫竹子 发表于 2022-11-28 13:25:20

suchocolate 发表于 2022-11-28 13:21
python版本多少,另外python的环境变量设置过了吧?

python 3.9, 环境变量还没设置过;
之前使用的时候时没问题的,后来一顿瞎操作又重装了一下pycharm,就出现这个问题了

jackz007 发表于 2022-11-28 13:27:59

      greenlet 的版本和你的 Python 版本不匹配,卸载,重装。
pip uninstall greenlet
pip install greenlet

熊猫竹子 发表于 2022-11-28 13:37:07

jackz007 发表于 2022-11-28 13:27
greenlet 的版本和你的 Python 版本不匹配,卸载,重装。

试过了,没有用

jackz007 发表于 2022-11-28 13:45:23

本帖最后由 jackz007 于 2022-11-28 13:53 编辑

熊猫竹子 发表于 2022-11-28 13:37
试过了,没有用

pip show greenlet
      记下版本号,比如 1.2.4
pip uninstall greenlet
      获取可用版本列表
pip install greenlet==
      从列表中找到不合适的版本号 1.2.4,选择上一个版本号安装,比如,1.2.3
pip install greenlet==1.2.3
      如果还是不行,那就继续减版本号,多试几次看看。
页: [1]
查看完整版本: 问题;ImportError: DLL load failed while importing _greenlet: 找不到指定的模块