ImportError: cannot import name ‘pre_init‘ from ‘langchain_core.utils‘

题意:导入错误:无法从'langchain_core.utils'中导入名称'pre_init'

问题背景:

When I want to install langchain libraries from requirements.txt I'm getting

我尝试从requirements.txt文件中安装langchain库时,遇到了如下错误

ImportError: cannot import name 'pre_init' from 'langchain_core.utils'

I've tried to install libraries from terminal using these commands :

我尝试使用这些命令从终端安装库:

pip install gigachain
pip install gigachat
pip install -U langchain-community

and it's working, so I used        有效,所以我使用命令

pip freeze

And pasted all libraries from the terminal to requirements.txt and it's doesn't work. It would be nice if someone could help

我尝试将从终端获取的所有库粘贴到requirements.txt文件中,但它不起作用。如果有人能帮忙就好了

问题解决:

Your import error suggests that the langchain-core module has not been installed. You can confirm whether this is the case by checking the output from the following command:

你的导入错误表明langchain-core模块尚未安装。你可以通过检查以下命令的输出结果来确认是否确实如此:

pip show langchain-core

If it hasn't been installed, ensure it is installed via the following command:

如果它尚未安装,请确保通过以下命令进行安装:

pip install langchain-core

As for using a requirements.txt file, simply creating it doesn't automatically install the packages listed within. You still have to run the following command in your terminal to install the listed packages:

关于使用requirements.txt文件,仅仅创建它并不会自动安装其中列出的包。你仍然需要在你的终端中运行以下命令来安装列出的包:

python -m pip install -r /path/to/requirements.txt

Finally, you don't have to manually create the requirements.txt file by coping and pasting the output from pip freeze. You can simply run:

最后,你不需要通过复制和粘贴pip freeze的输出内容来手动创建requirements.txt文件。你可以简单地运行:

python -m pip freeze > /path/to/requirements.txt

You can read more about requirement files under the requirements files section of the pip user guide.

你可以在pip用户指南的“requirement files”部分阅读更多关于需求文件的信息。

  • 13
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

营赢盈英

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值