Langchain UnstructedURLLoader 显示 Libmagic 不可用

问题描述 投票:0回答:1

尝试使用

UnstructuredURLLoader
但收到“libmagic 不可用”。

我有:

  • 安装langchain
  • 安装非结构化 libmagic python-magic python-magic-bin
  • 安装python-magic-bin==0.4.13
  • python_magic-0.4.13-py2.py3-none-any.whl(我什至尝试过其他版本)。我使用的是 AMD64 Windows 机器。
  • 卸载并重新安装。
  • Google、ChatGTP、stackoverflow 上的类似问题寻求答案。

代码:

from langchain.document_loaders import UnstructuredURLLoader
loader = UnstructuredURLLoader(
    urls = [
        "https://www.moneycontrol.com/news/business/banks/hdfc-bank-re-appoints-sanmoy-chakrabarti-as-chief-risk-officer-11259771.html",
        "https://www.moneycontrol.com/news/business/markets/market-corrects-post-rbi-ups-inflation-forecast-icrr-bet-on-these-top-10-rate-sensitive-stocks-ideas-11142611.html"
    ]
)
data = loader.load()
len(data)

错误:

libmagic is unavailable but assists in filetype detection on file-like objects. Please consider installing libmagic for better results.
Error fetching or processing https://www.moneycontrol.com/news/business/banks/hdfc-bank-re-appoints-sanmoy-chakrabarti-as-chief-risk-officer-11259771.html, exception: Invalid file. The FileType.UNK file type is not supported in partition.
libmagic is unavailable but assists in filetype detection on file-like objects. Please consider installing libmagic for better results.
Error fetching or processing https://www.moneycontrol.com/news/business/markets/market-corrects-post-rbi-ups-inflation-forecast-icrr-bet-on-these-top-10-rate-sensitive-stocks-ideas-11142611.html, exception: Invalid file. The FileType.UNK file type is not supported in partition.
python loader langchain large-language-model libmagic
1个回答
0
投票

解决方案:venv中libmagic.dll文件夹的路径必须添加到系统变量中。

以我为例: D:\ds_project

© www.soinside.com 2019 - 2024. All rights reserved.