LangChain虚拟环境

1.Python虚拟环境

参考文章: https://blog.csdn.net/lijunXHU/article/details/135115322

安装模块:

pip install virtualenv -i https://pypi.tuna.tsinghua.edu.cn/simple/

创建虚拟环境,默认创建的虚拟环境是在C盘

注意: Python的安装需要配置下环境变量信息。不然需要进入到Python的安装目录找到virtualenv这个脚本才能执行下面的命令

virtualenv虚拟环境的名字

virtualenv ragenv

修改默认的路径,指定路径

virtualenv D:\python_virtualenv\langchaindemo

进入虚拟环境

cd 虚拟环境的文件夹
cd Scripts
activate

例子:
cd ragenv
cd scripts
activate

jupyter中使用虚拟环境,要在虚拟环境中安装

pip install ipykernel -i https://pypi.tuna.tsinghua.edu.cn/simple/

接下来我们就可以将虚拟环境添加到 jupyter内核中,在虚拟环境中敲下面的命令

python -m ipykernel install --name 创建的虚拟环境名字
例子:python -m ipykernel install --name ragenv

PyCharm中使用虚拟环境
找到C盘中的虚拟环境目录中的python.exe即可

posted @ 2025-03-18 10:21  Michael_Z  阅读(50)  评论(0)    收藏  举报