{"id":70002,"date":"2026-02-01T10:56:57","date_gmt":"2026-02-01T02:56:57","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/70002.html"},"modified":"2026-02-01T10:56:57","modified_gmt":"2026-02-01T02:56:57","slug":"window%e4%b8%8a%e5%ae%89%e8%a3%85langchain%ef%bc%88%e9%80%82%e7%94%a8%e4%ba%8e%e5%b0%8f%e7%99%bd%e7%94%a8%e6%88%b7%ef%bc%8c%e4%ba%b2%e6%b5%8b%e6%9c%89%e6%95%88%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/70002.html","title":{"rendered":"Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09"},"content":{"rendered":"<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u60f3\u4e86\u89e3 LangChain \u5728 Windows \u7cfb\u7edf\u4e0a\u7684\u5b8c\u6574\u90e8\u7f72\u6b65\u9aa4&#xff0c;\u63a5\u4e0b\u6765\u5e2e\u4f60\u68b3\u7406\u4ece\u73af\u5883\u51c6\u5907\u5230\u9a8c\u8bc1\u6210\u529f\u7684\u5168\u5957\u6d41\u7a0b&#xff0c;\u5168\u7a0b\u517c\u987e\u65b0\u624b\u53cb\u597d\u6027&#xff0c;\u6b65\u9aa4\u6e05\u6670\u53ef\u843d\u5730\u3002<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u4e00\u3001\u524d\u7f6e\u51c6\u5907&#xff08;\u6838\u5fc3\u4f9d\u8d56&#xff09;<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">LangChain \u57fa\u4e8e Python \u5f00\u53d1&#xff0c;\u9996\u5148\u9700\u8981\u642d\u5efa\u5b8c\u6574\u7684 Python \u73af\u5883&#xff0c;\u63a8\u8350\u4f7f\u7528 Python 3.8 \u53ca\u4ee5\u4e0a\u7248\u672c&#xff08;\u517c\u5bb9 LangChain \u6240\u6709\u6838\u5fc3\u529f\u80fd&#xff0c;\u907f\u514d\u7248\u672c\u517c\u5bb9\u95ee\u9898&#xff09;\u3002<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">1. \u5b89\u88c5 Python<\/p>\n<li style=\"text-align:left\">\u8bbf\u95ee Python \u5b98\u65b9\u4e0b\u8f7d\u5730\u5740&#xff1a;https:\/\/www.python.org\/downloads\/windows\/<\/li>\n<li style=\"text-align:left\">\u4e0b\u6ed1\u9009\u62e9\u5bf9\u5e94 Windows \u7248\u672c&#xff08;32\u4f4d\/64\u4f4d&#xff0c;\u4f18\u5148\u9009 64\u4f4d&#xff09;&#xff0c;\u4e0b\u8f7d executable installer&#xff08;\u53ef\u6267\u884c\u5b89\u88c5\u5305&#xff0c;\u65b0\u624b\u9996\u9009&#xff09;\u3002<\/li>\n<li style=\"text-align:left\">\u8fd0\u884c\u5b89\u88c5\u5305&#xff0c;\u5173\u952e\u64cd\u4f5c&#xff1a;<\/li>\n<ul>\n<li style=\"text-align:left\">\u52fe\u9009 Add Python to PATH&#xff08;\u91cd\u4e2d\u4e4b\u91cd&#xff0c;\u81ea\u52a8\u914d\u7f6e\u73af\u5883\u53d8\u91cf&#xff0c;\u907f\u514d\u540e\u7eed\u624b\u52a8\u914d\u7f6e\u9ebb\u70e6&#xff09;\u3002<\/li>\n<\/ul>\n<ul>\n<li style=\"text-align:left\">\u9009\u62e9 Customize installation&#xff08;\u81ea\u5b9a\u4e49\u5b89\u88c5&#xff09;&#xff0c;\u4fdd\u6301\u9ed8\u8ba4\u9009\u9879\u4e0b\u4e00\u6b65&#xff0c;\u53ef\u4fee\u6539\u5b89\u88c5\u8def\u5f84&#xff08;\u5efa\u8bae\u8def\u5f84\u4e0d\u542b\u4e2d\u6587\u548c\u7a7a\u683c&#xff0c;\u5982 <span style=\"background-color:#eff0f1\">D:\\\\Python311<\/span>&#xff09;\u3002<\/li>\n<\/ul>\n<ul>\n<li style=\"text-align:left\">\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u9a8c\u8bc1\u662f\u5426\u6210\u529f&#xff1a;<\/li>\n<\/ul>\n<ul>\n<li style=\"text-align:left\">\u6309\u4e0b <span style=\"background-color:#eff0f1\">Win &#043; R<\/span>&#xff0c;\u8f93\u5165 <span style=\"background-color:#eff0f1\">cmd<\/span>\u00a0\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/li>\n<\/ul>\n<ul>\n<li style=\"text-align:left\">\u8f93\u5165\u547d\u4ee4 <span style=\"background-color:#eff0f1\">python &#8211;version<\/span>\u00a0\u6216 <span style=\"background-color:#eff0f1\">python3 &#8211;version<\/span>&#xff0c;\u82e5\u663e\u793a\u7c7b\u4f3c <span style=\"background-color:#eff0f1\">Python 3.11.7<\/span>\u00a0\u7684\u7248\u672c\u4fe1\u606f&#xff0c;\u8bf4\u660e Python \u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/ul>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">2. &#xff08;\u53ef\u9009\u4f46\u63a8\u8350&#xff09;\u914d\u7f6e\u865a\u62df\u73af\u5883<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u4e3a\u4e86\u9694\u79bb\u4e0d\u540c\u9879\u76ee\u7684\u4f9d\u8d56&#xff0c;\u907f\u514d\u7248\u672c\u51b2\u7a81&#xff0c;\u63a8\u8350\u4f7f\u7528 Python \u81ea\u5e26\u7684 <span style=\"background-color:#eff0f1\">venv<\/span>\u00a0\u521b\u5efa\u865a\u62df\u73af\u5883&#xff0c;\u6b65\u9aa4\u5982\u4e0b&#xff1a;<\/p>\n<li style=\"text-align:left\">\u6253\u5f00 cmd&#xff0c;\u521b\u5efa\u4e00\u4e2a\u4e13\u95e8\u5b58\u653e LangChain \u9879\u76ee\u7684\u6587\u4ef6\u5939&#xff08;\u5982 <span style=\"background-color:#eff0f1\">D:\\\\LangChain_Project<\/span>&#xff09;&#xff0c;\u6267\u884c\u547d\u4ee4&#xff1a;<\/li>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:22.0500pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:391.3500pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> # \u5207\u6362\u5230 D \u76d8 D: # \u521b\u5efa\u6587\u4ef6\u5939 md LangChain_Project # \u8fdb\u5165\u8be5\u6587\u4ef6\u5939 cd LangChain_Project<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<li style=\"text-align:left\">\u521b\u5efa\u865a\u62df\u73af\u5883&#xff08;\u73af\u5883\u540d\u81ea\u5b9a\u4e49&#xff0c;\u8fd9\u91cc\u7528 <span style=\"background-color:#eff0f1\">langchain_env<\/span>&#xff09;&#xff1a;<\/li>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:22.0500pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:391.3500pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> python -m venv langchain_env<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<li style=\"text-align:left\"><span style=\"background-color:#ffff00\">\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/span>&#xff1a;<\/li>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:22.0500pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:391.3500pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> # Windows cmd \u4e2d\u6267\u884c&#xff08;\u5982\u679c\u7528 PowerShell&#xff0c;\u547d\u4ee4\u7565\u6709\u4e0d\u540c&#xff0c;\u89c1\u4e0b\u65b9\u5907\u6ce8&#xff09; <span style=\"background-color:#ffff00\">langchain_env\\\\Scripts\\\\activate.bat<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li style=\"text-align:left\">\u6fc0\u6d3b\u6210\u529f\u540e&#xff0c;\u547d\u4ee4\u884c\u524d\u7f00\u4f1a\u51fa\u73b0 <span style=\"background-color:#eff0f1\">(langchain_env)<\/span>&#xff0c;\u8868\u793a\u5f53\u524d\u5904\u4e8e\u8be5\u865a\u62df\u73af\u5883\u4e2d\u3002<\/li>\n<\/ul>\n<ul>\n<li style=\"text-align:left\">\u5907\u6ce8&#xff1a;Windows PowerShell \u4e2d\u6fc0\u6d3b\u547d\u4ee4\u4e3a <span style=\"background-color:#eff0f1\">.\\\\langchain_env\\\\Scripts\\\\Activate.ps1<\/span>&#xff0c;\u82e5\u51fa\u73b0\u6743\u9650\u62a5\u9519&#xff0c;\u9700\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c PowerShell&#xff0c;\u6267\u884c <span style=\"background-color:#eff0f1\">Set-ExecutionPolicy RemoteSigned<\/span>&#xff0c;\u9009\u62e9 <span style=\"background-color:#eff0f1\">Y<\/span>\u00a0\u5373\u53ef\u89e3\u51b3\u3002<\/li>\n<\/ul>\n<li style=\"text-align:left\">&#xff08;\u540e\u7eed\u64cd\u4f5c&#xff09;\u6240\u6709\u4f9d\u8d56\u5b89\u88c5\u90fd\u5728\u6fc0\u6d3b\u540e\u7684\u865a\u62df\u73af\u5883\u4e2d\u8fdb\u884c&#xff0c;<span style=\"background-color:#ffff00\">\u9000\u51fa\u865a\u62df\u73af\u5883\u7684\u547d\u4ee4<\/span>\u4e3a <span style=\"background-color:#eff0f1\">deactivate<\/span>\u3002<\/li>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u4e8c\u3001\u5b89\u88c5 LangChain \u6838\u5fc3\u5305<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">LangChain \u63d0\u4f9b\u4e86\u591a\u4e2a\u7248\u672c\u7684\u5305&#xff0c;\u6838\u5fc3\u5305\u6ee1\u8db3\u57fa\u7840\u529f\u80fd&#xff0c;\u5b8c\u6574\u5305\u5305\u542b\u6240\u6709\u6269\u5c55\u4f9d\u8d56&#xff0c;\u5206\u4e24\u79cd\u5b89\u88c5\u65b9\u5f0f&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">1. \u5b89\u88c5\u6838\u5fc3\u5305&#xff08;\u4ec5\u6ee1\u8db3\u57fa\u7840\u529f\u80fd&#xff0c;\u4f53\u79ef\u5c0f&#xff09;<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u5728\u6fc0\u6d3b\u7684\u865a\u62df\u73af\u5883\u4e2d\u6267\u884c\u547d\u4ee4&#xff1a;<\/p>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> pip install langchain<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">2. \u5b89\u88c5\u5b8c\u6574\u5305&#xff08;\u5305\u542b\u6240\u6709\u6269\u5c55\u4f9d\u8d56&#xff0c;\u63a8\u8350&#xff0c;\u907f\u514d\u540e\u7eed\u7f3a\u5c11\u4f9d\u8d56&#xff09;<\/p>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> pip install langchain[all]<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">3. \u52a0\u901f\u5b89\u88c5&#xff08;\u89e3\u51b3\u56fd\u5185\u4e0b\u8f7d\u6162\u3001\u8d85\u65f6\u95ee\u9898&#xff09;<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90&#xff08;\u963f\u91cc\u4e91\/\u6e05\u534e\u6e90&#xff09;\u52a0\u901f&#xff0c;\u547d\u4ee4\u683c\u5f0f\u5982\u4e0b&#xff08;\u4ee5\u5b8c\u6574\u5305\u4e3a\u4f8b&#xff0c;\u6838\u5fc3\u5305\u540c\u7406&#xff09;&#xff1a;<\/p>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> # \u963f\u91cc\u4e91\u955c\u50cf&#xff08;\u63a8\u8350&#xff0c;\u901f\u5ea6\u7a33\u5b9a&#xff09; pip install langchain[all] -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/  # \u6e05\u534e\u955c\u50cf pip install langchain[all] -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple\/<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u4e09\u3001\u5b89\u88c5\u989d\u5916\u4f9d\u8d56&#xff08;\u6309\u9700\u9009\u62e9&#xff09;<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">LangChain \u672c\u8eab\u662f\u4e00\u4e2a\u6846\u67b6&#xff0c;\u5f88\u591a\u529f\u80fd&#xff08;\u5982\u8fde\u63a5\u5927\u6a21\u578b\u3001\u5411\u91cf\u6570\u636e\u5e93\u3001\u6587\u6863\u89e3\u6790&#xff09;\u9700\u8981\u4f9d\u8d56\u989d\u5916\u7684\u7b2c\u4e09\u65b9\u5305&#xff0c;\u4ee5\u4e0b\u662f\u5e38\u7528\u4f9d\u8d56\u7684\u5b89\u88c5&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">1. \u5927\u6a21\u578b\u76f8\u5173\u4f9d\u8d56&#xff08;\u6838\u5fc3\u5e38\u7528&#xff09;<\/p>\n<ul>\n<li style=\"text-align:left\">\u5bf9\u63a5 OpenAI \u7cfb\u5217\u6a21\u578b&#xff08;GPT-3.5\/4 \u7b49&#xff09;&#xff1a;<\/li>\n<\/ul>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:22.0500pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:391.3500pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> pip install openai -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li style=\"text-align:left\">\u5bf9\u63a5\u56fd\u5185\u6a21\u578b&#xff08;\u5982\u901a\u4e49\u5343\u95ee\u3001\u6587\u5fc3\u4e00\u8a00&#xff09;&#xff1a;<\/li>\n<\/ul>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:22.0500pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:391.3500pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> # \u901a\u4e49\u5343\u95ee pip install dashscope -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/ # \u6587\u5fc3\u4e00\u8a00 pip install qianfan -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">2. \u5411\u91cf\u6570\u636e\u5e93\u76f8\u5173\u4f9d\u8d56&#xff08;\u7528\u4e8e\u77e5\u8bc6\u5e93\u3001RAG \u573a\u666f&#xff09;<\/p>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> # \u8f7b\u91cf\u7ea7\u5411\u91cf\u6570\u636e\u5e93&#xff08;\u65b0\u624b\u5165\u95e8\u9996\u9009&#xff09; pip install chromadb -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/  # \u5176\u4ed6\u5e38\u7528\u5411\u91cf\u6570\u636e\u5e93&#xff08;\u6309\u9700\u5b89\u88c5&#xff09; pip install pinecone-client faiss-cpu -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">3. \u6587\u6863\u89e3\u6790\u76f8\u5173\u4f9d\u8d56&#xff08;\u7528\u4e8e\u89e3\u6790 PDF\u3001Word \u7b49\u6587\u6863&#xff09;<\/p>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> pip install pypdf python-docx -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u56db\u3001\u9a8c\u8bc1 LangChain \u90e8\u7f72\u6210\u529f<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u901a\u8fc7\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684 Python \u811a\u672c&#xff0c;\u9a8c\u8bc1 LangChain \u80fd\u5426\u6b63\u5e38\u8fd0\u884c&#xff0c;\u8fd9\u91cc\u4ee5\u57fa\u7840\u7684 <span style=\"background-color:#eff0f1\">LLMChain<\/span>\u00a0\u4e3a\u4f8b&#xff08;\u82e5\u672a\u5b89\u88c5 OpenAI&#xff0c;\u53ef\u8df3\u8fc7\u8be5\u793a\u4f8b&#xff0c;\u4f7f\u7528 LangChain \u5185\u7f6e\u7684\u7b80\u6613\u6a21\u578b\u9a8c\u8bc1&#xff09;\u3002<\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u793a\u4f8b 1&#xff1a;\u4f7f\u7528\u5185\u7f6e\u7b80\u6613\u6a21\u578b\u9a8c\u8bc1&#xff08;\u65e0\u9700 API \u5bc6\u94a5&#xff0c;\u96f6\u914d\u7f6e&#xff09;<\/p>\n<li style=\"text-align:left\">\u5728 <span style=\"background-color:#eff0f1\">D:\\\\LangChain_Project<\/span>\u00a0\u6587\u4ef6\u5939\u4e2d&#xff0c;\u521b\u5efa\u4e00\u4e2a <span style=\"background-color:#eff0f1\">test_langchain.py<\/span>\u00a0\u6587\u4ef6&#xff0c;\u5199\u5165\u4ee5\u4e0b\u4ee3\u7801&#xff1a;<\/li>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># \u5bfc\u5165 LangChain 1.2.7 \u9002\u914d\u6a21\u5757&#xff08;\u96f6\u914d\u7f6e&#xff0c;\u65e0\u9700 API \u5bc6\u94a5&#xff09;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">from langchain_core.prompts import PromptTemplate<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">from langchain_community.llms.fake import FakeListLLM \u00a0# \u7eaf\u6a21\u62df\u6a21\u578b&#xff0c;\u65e0\u5916\u90e8\u4f9d\u8d56<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">from langchain_core.runnables import RunnableSequence<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 1. \u521d\u59cb\u5316\u6a21\u62df LLM \u6a21\u578b&#xff08;\u9884\u8bbe\u8fd4\u56de\u7ed3\u679c&#xff0c;\u9002\u914d\u6a21\u677f\u4e2d\u7684 topic \u53d8\u91cf&#xff09;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># \u8fd9\u91cc\u9884\u8bbe\u4e00\u6bb5\u5173\u4e8e LangChain \u7684\u4ecb\u7ecd&#xff0c;\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u591a\u6761\u7ed3\u679c\u8f6e\u8be2\u8fd4\u56de<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">llm &#061; FakeListLLM(<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">\u00a0\u00a0\u00a0\u00a0responses&#061;[<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#034;LangChain \u662f\u4e00\u6b3e\u5f00\u6e90\u5927\u8bed\u8a00\u6a21\u578b\u5e94\u7528\u5f00\u53d1\u6846\u67b6&#xff0c;\u652f\u6301\u96c6\u6210\u5916\u90e8\u6570\u636e\u3001\u7b2c\u4e09\u65b9\u5de5\u5177&#xff0c;\u80fd\u5feb\u901f\u642d\u5efa\u77e5\u8bc6\u5e93\u3001\u5bf9\u8bdd\u673a\u5668\u4eba\u7b49\u590d\u6742 LLM \u5e94\u7528&#xff0c;\u64cd\u4f5c\u7b80\u6d01\u4e14\u6269\u5c55\u6027\u5f3a\u3002&#034;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">\u00a0\u00a0\u00a0\u00a0]<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">)<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 2. \u5b9a\u4e49\u63d0\u793a\u8bcd\u6a21\u677f<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">prompt_template &#061; PromptTemplate(<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">\u00a0\u00a0\u00a0\u00a0input_variables&#061;[&#034;topic&#034;],<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">\u00a0\u00a0\u00a0\u00a0template&#061;&#034;\u8bf7\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b {topic}&#xff0c;\u5b57\u6570\u63a7\u5236\u5728100\u5b57\u4ee5\u5185\u3002&#034;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">)<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 3. \u6784\u5efa\u65b0\u7248\u94fe\u5f0f\u8c03\u7528&#xff08;\u7ba1\u9053\u7b26 | \u662f 1.0&#043; \u63a8\u8350\u5199\u6cd5&#xff09;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">llm_chain &#061; prompt_template | llm<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 4. \u8fd0\u884c\u5e76\u8f93\u51fa\u7ed3\u679c<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">result &#061; llm_chain.invoke({&#034;topic&#034;: &#034;LangChain&#034;})<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 5. \u8f93\u51fa\u6700\u7ec8\u7ed3\u679c<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">print(&#034;\u8f93\u51fa\u7ed3\u679c&#xff1a;&#034;)<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">print(result)<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<li style=\"text-align:left\">\u5728 cmd \u4e2d&#xff08;\u4fdd\u6301\u865a\u62df\u73af\u5883\u6fc0\u6d3b&#xff09;&#xff0c;\u5207\u6362\u5230 <span style=\"background-color:#eff0f1\">D:\\\\LangChain_Project<\/span>\u00a0\u6587\u4ef6\u5939&#xff0c;\u6267\u884c\u811a\u672c&#xff1a;<\/li>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">Bash<\/span> python test_langchain.py<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<li style=\"text-align:left\">\u82e5\u80fd\u6b63\u5e38\u8f93\u51fa\u5173\u4e8e LangChain \u7684\u7b80\u5355\u4ecb\u7ecd&#xff0c;\u8bf4\u660e LangChain \u6838\u5fc3\u73af\u5883\u90e8\u7f72\u6210\u529f\u3002<\/li>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u793a\u4f8b 2&#xff1a;\u4f7f\u7528 OpenAI \u6a21\u578b\u9a8c\u8bc1&#xff08;\u9700\u81ea\u5907 OpenAI API \u5bc6\u94a5&#xff09;<\/p>\n<li style=\"text-align:left\">\u4fee\u6539 <span style=\"background-color:#eff0f1\">test_langchain.py<\/span>\u00a0\u4ee3\u7801&#xff1a;<\/li>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># \u5bfc\u5165\u5fc5\u8981\u6a21\u5757<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">import os<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">from langchain_core.prompts import PromptTemplate<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">from langchain_openai import OpenAI \u00a0# \u65b0\u7248\u4e13\u7528 OpenAI \u5ba2\u6237\u7aef<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">from langchain_core.runnables import RunnableSequence<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 1. \u914d\u7f6e OpenAI API \u5bc6\u94a5&#xff08;\u4e24\u79cd\u65b9\u5f0f\u4e8c\u9009\u4e00&#xff09;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># \u65b9\u5f0f 1&#xff1a;\u76f4\u63a5\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">os.environ[&#034;OPENAI_API_KEY&#034;] &#061; &#034;\u4f60\u7684 OpenAI API \u5bc6\u94a5&#034; \u00a0# \u66ff\u6362\u4e3a\u771f\u5b9e\u5bc6\u94a5<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># \u65b9\u5f0f 2&#xff1a;\u521d\u59cb\u5316\u6a21\u578b\u65f6\u76f4\u63a5\u4f20\u5165&#xff08;\u4f18\u5148\u7ea7\u66f4\u9ad8&#xff09;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># llm &#061; OpenAI(openai_api_key&#061;&#034;\u4f60\u7684 OpenAI API \u5bc6\u94a5&#034;, temperature&#061;0.7)<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 2. \u521d\u59cb\u5316 OpenAI \u6a21\u578b<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">llm &#061; OpenAI(temperature&#061;0.7)<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 3. \u5b9a\u4e49\u63d0\u793a\u8bcd\u6a21\u677f<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">prompt_template &#061; PromptTemplate(<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">\u00a0\u00a0\u00a0\u00a0input_variables&#061;[&#034;topic&#034;],<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">\u00a0\u00a0\u00a0\u00a0template&#061;&#034;\u8bf7\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b {topic}&#xff0c;\u5b57\u6570\u63a7\u5236\u5728100\u5b57\u4ee5\u5185\u3002&#034;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">)<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 4. \u6784\u5efa\u94fe\u5f0f\u8c03\u7528<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">llm_chain &#061; prompt_template | llm<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 5. \u8fd0\u884c\u5e76\u8f93\u51fa\u7ed3\u679c<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">result &#061; llm_chain.invoke({&#034;topic&#034;: &#034;LangChain&#034;})<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># 6. \u8f93\u51fa\u7ed3\u679c<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">print(&#034;\u8f93\u51fa\u7ed3\u679c&#xff1a;&#034;)<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">print(result)<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<li style=\"text-align:left\">\u6267\u884c\u811a\u672c&#xff0c;\u82e5\u80fd\u6b63\u5e38\u8fd4\u56de GPT-3.5 \u751f\u6210\u7684\u7ed3\u679c&#xff0c;\u8bf4\u660e LangChain \u4e0e OpenAI \u6a21\u578b\u7684\u5bf9\u63a5\u4e5f\u6b63\u5e38\u3002<\/li>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u4e94\u3001\u5e38\u89c1\u95ee\u9898\u6392\u67e5<\/p>\n<li style=\"text-align:left\">\u62a5\u9519 <span style=\"background-color:#eff0f1\">ModuleNotFoundError: No module named &#039;langchain&#039;<\/span>&#xff1a;\u8bf4\u660e LangChain \u672a\u5b89\u88c5\u6210\u529f&#xff0c;\u6216\u672a\u5728\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u7684\u7ec8\u7aef\u4e2d\u6267\u884c\u811a\u672c&#xff0c;\u91cd\u65b0\u5b89\u88c5\u5e76\u786e\u8ba4\u865a\u62df\u73af\u5883\u6fc0\u6d3b\u72b6\u6001\u3002<\/li>\n<li style=\"text-align:left\">\u4e0b\u8f7d\u8d85\u65f6\u3001\u62a5\u9519 <span style=\"background-color:#eff0f1\">ReadTimeoutError<\/span>&#xff1a;\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90\u91cd\u65b0\u5b89\u88c5&#xff0c;\u6216\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5\u3002<\/li>\n<li style=\"text-align:left\">PowerShell \u6fc0\u6d3b\u865a\u62df\u73af\u5883\u6743\u9650\u62a5\u9519&#xff1a;\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c PowerShell&#xff0c;\u6267\u884c <span style=\"background-color:#eff0f1\">Set-ExecutionPolicy RemoteSigned<\/span>\u00a0\u89e3\u51b3\u3002<\/li>\n<li style=\"text-align:left\">\u4f9d\u8d56\u7248\u672c\u51b2\u7a81&#xff1a;\u5efa\u8bae\u4f7f\u7528\u5168\u65b0\u7684\u865a\u62df\u73af\u5883&#xff0c;\u907f\u514d\u4e0e\u5176\u4ed6\u9879\u76ee\u4f9d\u8d56\u51b2\u7a81&#xff0c;\u82e5\u4ecd\u6709\u51b2\u7a81&#xff0c;\u53ef\u6307\u5b9a\u5177\u4f53\u7248\u672c\u5b89\u88c5&#xff08;\u5982 <span style=\"background-color:#eff0f1\">pip install langchain&#061;&#061;0.1.0<\/span>&#xff09;\u3002<\/li>\n<li style=\"text-align:left\">\u5b89\u88c5\u7684LangChain \u5305\u4e0d\u5b8c\u6574&#xff0c;\u5bfc\u81f4\u8fd0\u884c\u65f6\u7f3a\u5c11\u76f8\u5173\u7ec4\u4ef6&#xff0c;\u53ef\u4ee5\u91cd\u65b0\u5378\u8f7d\u5f53\u524d\u6b8b\u7f3a\u7684langChain&#xff0c;\u91cd\u65b0\u5b89\u88c5\u5b8c\u6574\u5305\u3002<\/li>\n<table border=\"1\" cellspacing=\"0\" style=\"margin-left:-0.6000pt\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f6f7;width:414.0000pt\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># \u5148\u5378\u8f7d\u5f53\u524d\u6b8b\u7f3a\u7684 LangChain<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">pip uninstall langchain -y<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\"># \u5b89\u88c5 LangChain \u5b8c\u6574\u5305&#xff08;1.2.7 \u7248\u672c&#xff0c;\u5305\u542b\u6240\u6709\u7ec4\u4ef6&#xff0c;\u5305\u62ec chains&#xff09;<\/span><\/p>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\"><span style=\"color:#646a73\">pip install langchain[all]&#061;&#061;1.2.7 -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:justify\">\n<p style=\"margin-left:.0001pt;margin-right:0;text-align:left\">\u603b\u7ed3<\/p>\n<li style=\"text-align:left\">\u6838\u5fc3\u524d\u7f6e\u6761\u4ef6\u662f\u5b89\u88c5 Python 3.8&#043;\u00a0\u5e76\u52fe\u9009 <span style=\"background-color:#eff0f1\">Add Python to PATH<\/span>&#xff0c;\u63a8\u8350\u4f7f\u7528\u865a\u62df\u73af\u5883\u9694\u79bb\u4f9d\u8d56\u3002<\/li>\n<li style=\"text-align:left\">LangChain \u5b89\u88c5\u4f18\u5148\u9009\u62e9\u5b8c\u6574\u5305 <span style=\"background-color:#eff0f1\">langchain[all]<\/span>&#xff0c;\u642d\u914d\u56fd\u5185\u955c\u50cf\u6e90\u52a0\u901f\u4e0b\u8f7d&#xff0c;\u907f\u514d\u4f9d\u8d56\u7f3a\u5931\u3002<\/li>\n<li style=\"text-align:left\">\u90e8\u7f72\u6210\u529f\u7684\u9a8c\u8bc1\u53ef\u901a\u8fc7\u5185\u7f6e\u7b80\u6613\u6a21\u578b\u5feb\u901f\u5b8c\u6210&#xff08;\u65e0\u9700 API \u5bc6\u94a5&#xff09;&#xff0c;\u590d\u6742\u529f\u80fd\u9700\u989d\u5916\u5b89\u88c5\u5bf9\u5e94\u7b2c\u4e09\u65b9\u4f9d\u8d56&#xff08;\u5982 OpenAI\u3001Chromadb&#xff09;\u3002<\/li>\n<li style=\"text-align:left\">\u6240\u6709\u64cd\u4f5c\u5efa\u8bae\u5728\u6fc0\u6d3b\u540e\u7684\u865a\u62df\u73af\u5883\u4e2d\u8fdb\u884c&#xff0c;\u907f\u514d\u6c61\u67d3\u5168\u5c40 Python \u73af\u5883\u3002<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u60f3\u4e86\u89e3 LangChain \u5728 Windows \u7cfb\u7edf\u4e0a\u7684\u5b8c\u6574\u90e8\u7f72\u6b65\u9aa4&#xff0c;\u63a5\u4e0b\u6765\u5e2e\u4f60\u68b3\u7406\u4ece\u73af\u5883\u51c6\u5907\u5230\u9a8c\u8bc1\u6210\u529f\u7684\u5168\u5957\u6d41\u7a0b&#xff0c;\u5168\u7a0b\u517c\u987e\u65b0\u624b\u53cb\u597d\u6027&#xff0c;\u6b65\u9aa4\u6e05\u6670\u53ef\u843d\u5730\u3002<br \/>\n\u4e00\u3001\u524d\u7f6e\u51c6\u5907&#xff08;\u6838\u5fc3\u4f9d\u8d56&#xff09;<br \/>\nLangChain \u57fa\u4e8e Python \u5f00\u53d1&#xff0c;\u9996\u5148\u9700\u8981\u642d\u5efa\u5b8c\u6574\u7684 Python \u73af\u5883&#xff0c;\u63a8\u8350\u4f7f\u7528 Python 3.8 \u53ca\u4ee5\u4e0a\u7248\u672c&#xff08;\u517c\u5bb9 LangChain \u6240\u6709\u6838\u5fc3\u529f\u80fd&#xff0c;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[997],"topic":[],"class_list":["post-70002","post","type-post","status-publish","format-standard","hentry","category-server","tag-langchain"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/70002.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u60f3\u4e86\u89e3 LangChain \u5728 Windows \u7cfb\u7edf\u4e0a\u7684\u5b8c\u6574\u90e8\u7f72\u6b65\u9aa4&#xff0c;\u63a5\u4e0b\u6765\u5e2e\u4f60\u68b3\u7406\u4ece\u73af\u5883\u51c6\u5907\u5230\u9a8c\u8bc1\u6210\u529f\u7684\u5168\u5957\u6d41\u7a0b&#xff0c;\u5168\u7a0b\u517c\u987e\u65b0\u624b\u53cb\u597d\u6027&#xff0c;\u6b65\u9aa4\u6e05\u6670\u53ef\u843d\u5730\u3002 \u4e00\u3001\u524d\u7f6e\u51c6\u5907&#xff08;\u6838\u5fc3\u4f9d\u8d56&#xff09; LangChain \u57fa\u4e8e Python \u5f00\u53d1&#xff0c;\u9996\u5148\u9700\u8981\u642d\u5efa\u5b8c\u6574\u7684 Python \u73af\u5883&#xff0c;\u63a8\u8350\u4f7f\u7528 Python 3.8 \u53ca\u4ee5\u4e0a\u7248\u672c&#xff08;\u517c\u5bb9 LangChain \u6240\u6709\u6838\u5fc3\u529f\u80fd&#xff0c;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/70002.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-01T02:56:57+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/70002.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/70002.html\",\"name\":\"Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-01T02:56:57+00:00\",\"dateModified\":\"2026-02-01T02:56:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/70002.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/70002.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/70002.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/70002.html","og_locale":"zh_CN","og_type":"article","og_title":"Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u60f3\u4e86\u89e3 LangChain \u5728 Windows \u7cfb\u7edf\u4e0a\u7684\u5b8c\u6574\u90e8\u7f72\u6b65\u9aa4&#xff0c;\u63a5\u4e0b\u6765\u5e2e\u4f60\u68b3\u7406\u4ece\u73af\u5883\u51c6\u5907\u5230\u9a8c\u8bc1\u6210\u529f\u7684\u5168\u5957\u6d41\u7a0b&#xff0c;\u5168\u7a0b\u517c\u987e\u65b0\u624b\u53cb\u597d\u6027&#xff0c;\u6b65\u9aa4\u6e05\u6670\u53ef\u843d\u5730\u3002 \u4e00\u3001\u524d\u7f6e\u51c6\u5907&#xff08;\u6838\u5fc3\u4f9d\u8d56&#xff09; LangChain \u57fa\u4e8e Python \u5f00\u53d1&#xff0c;\u9996\u5148\u9700\u8981\u642d\u5efa\u5b8c\u6574\u7684 Python \u73af\u5883&#xff0c;\u63a8\u8350\u4f7f\u7528 Python 3.8 \u53ca\u4ee5\u4e0a\u7248\u672c&#xff08;\u517c\u5bb9 LangChain \u6240\u6709\u6838\u5fc3\u529f\u80fd&#xff0c;","og_url":"https:\/\/www.wsisp.com\/helps\/70002.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-01T02:56:57+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/70002.html","url":"https:\/\/www.wsisp.com\/helps\/70002.html","name":"Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-01T02:56:57+00:00","dateModified":"2026-02-01T02:56:57+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/70002.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/70002.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/70002.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Window\u4e0a\u5b89\u88c5langChain\uff08\u9002\u7528\u4e8e\u5c0f\u767d\u7528\u6237\uff0c\u4eb2\u6d4b\u6709\u6548\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/70002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=70002"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/70002\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=70002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=70002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=70002"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=70002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}