使用UnstructuredPDFLoader时未找到unstructured包,请使用`pip install unstructured

`安装

我刚刚在Anaconda中创建了一个新的环境(conda 22.9.0 和 Python 3.10.10)。然后我尝试安装langchain(如果我尝试使用conda install langchain,它不起作用,所以使用pip install langchain)。根据快速入门指南,我需要安装一个模型提供商,所以我安装了openai(pip install openai)。

然后我进入Python控制台,尝试使用UnstructuredPDFLoader类加载一个PDF文件,但出现了以下错误。问题可能出在哪里?

(langchain) C:\Users\user>pythonPython 3.10.10 | packaged by Anaconda, Inc. | (main, Mar 21 2023, 18:39:17) [MSC v.1916 64 bit (AMD64)] on win32>>> from langchain.document_loaders import UnstructuredPDFLoader>>> loader = UnstructuredPDFLoader("C:\\<path-to-data>\\data\\name-of-file.pdf")Traceback (most recent call last):  File "C:\<path-to-anaconda>\envs\langchain\lib\site-packages\langchain\document_loaders\unstructured.py", line 32, in __init__    import unstructured  # noqa:F401ModuleNotFoundError: No module named 'unstructured'During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "C:\<path-to-anaconda>\envs\langchain\lib\site-packages\langchain\document_loaders\unstructured.py", line 90, in __init__    super().__init__(mode=mode, **unstructured_kwargs)  File "C:\<path-to-anaconda>\envs\langchain\lib\site-packages\langchain\document_loaders\unstructured.py", line 34, in __init__    raise ValueError(ValueError: unstructured package not found, please install it with `pip install unstructured`

回答:

运行以下命令:
pip install unstructured
或者:
pip install “unstructured[local-inference]”

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注