尝试导入 selectorlib 时出现 ImportError

问题描述 投票:0回答:0
Traceback (most recent call last):
File "/Users/raiyankhan/Desktop/Python projects/web-scraping/main.py", line 2, in <module>
import selectorlib
File "/Users/raiyankhan/Desktop/Python projects/web-scraping/venv/lib/python3.11/site-packages/selectorlib/__init__.py", line 9, in <module>
from .selectorlib import Extractor  # noqa:F401
> >     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/raiyankhan/Desktop/Python projects/web-scraping/venv/lib/python3.11/site-packages/selectorlib/selectorlib.py", line 2, in <module>
import parsel
File "/Users/raiyankhan/Desktop/Python projects/web-scraping/venv/lib/python3.11/site-packages/parsel/__init__.py", line 16, in <module>
from parsel.selector import Selector, SelectorList  # NOQA
> >     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/raiyankhan/Desktop/Python projects/web-scraping/venv/lib/python3.11/site-packages/parsel/selector.py", line 21, in <module>
from lxml import etree, html
ImportError: dlopen(/Users/raiyankhan/Desktop/Python projects/web-scraping/venv/lib/python3.11/site-packages/lxml/etree.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '_exsltDateXpathCtxtRegister'

重装、升级、下载了lmxl和libxstl的所有依赖,还是不行

我的系统是Macbook air m2

OS = MacOS Venture 13.0.1

我试图制作一个程序来使用 selectorlib 模块来抓取网络信息。在 pycharm 中显示上述错误,在 vscode 中显示找不到模块。

python python-3.x web-scraping pycharm importerror
© www.soinside.com 2019 - 2024. All rights reserved.