MetaGPT 安装
1. 创建环境
conda create -n metagpt python=3.10 && conda activate metagpt
2. 可编辑方式安装
git clone --depth 1 https://github.com/geekan/MetaGPT.git
cd MetaGPT
pip install -e .
3. 配置
metagpt --init-config
运行命令,在C盘位置C:\Users\32564\.metagpt
出现yaml文件
原始yaml文件:
# Full Example: https://github.com/geekan/MetaGPT/blob/main/config/config2.example.yaml
# Reflected Code: https://github.com/geekan/MetaGPT/blob/main/metagpt/config2.py
# Config Docs: https://docs.deepwisdom.ai/main/en/guide/get_started/configuration.html
llm:
api_type: "openai" # or azure / ollama / groq etc. Check LLMType for more options
model: "gpt-4-turbo" # or gpt-3.5-turbo
base_url: "https://api.openai.com/v1" # or forward url / other llm url
api_key: "YOUR_API_KEY"
换成chatglm模型:
# Full Example: https://github.com/geekan/MetaGPT/blob/main/config/config2.example.yaml
# Reflected Code: https://github.com/geekan/MetaGPT/blob/main/metagpt/config2.py
# Config Docs: https://docs.deepwisdom.ai/main/en/guide/get_started/configuration.html
llm:
api_type: "openai" # or azure / ollama / groq etc.
model: "GLM-4-plus" # or gpt-3.5-turbo
base_url: "https://open.bigmodel.cn/api/paas/v4/" # or forward url / other llm url
api_key: "your api key"
4. 验证
运行此命令:
metagpt "Create a 2048 game"
结果:
后面测试生成的代码不能用,可能是chatglm模型的问题
安装过程中可能出现的问题
1. 最好用python版本为3.10,版本为3.11可能会出现很多问题
2. git 问题
原始命令 git clone https://github.com/geekan/MetaGPT.git 可能会出现问题
git clone https://github.com/geekan/MetaGPT.git
Cloning into 'MetaGPT'...
remote: Enumerating objects: 47689, done.
remote: Counting objects: 100% (9943/9943), done.
remote: Compressing objects: 100% (2173/2173), done.
error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
error: 14489 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
解决方式:
git clone --depth 1 https://github.com/geekan/MetaGPT.git
3. volcengine-python-sdk 问题
具体报错:
WARNING: Ignoring invalid cache entry origin file C:\users\32564\appdata\local\pip\cache\wheels\be\90\01\414977693c2baab139281145b9ea24c8367a67de0d1ff4ddfc\origin.json for volcengine_python_sdk-1.0.112-py3-none-any.whl (Expecting value: line 1 column 1 (char 0))
Collecting volcengine-python-sdk~=1.0.94 (from volcengine-python-sdk[ark]~=1.0.94->metagpt==0.8.1)
Using cached volcengine_python_sdk-1.0.112-py3-none-any.whl
ERROR: Wheel 'volcengine-python-sdk' located at C:\users\32564\appdata\local\pip\cache\wheels\be\90\01\414977693c2baab139281145b9ea24c8367a67de0d1ff4ddfc\volcengine_python_sdk-1.0.112-py3-none-any.whl is invalid.
可能原因:
1. 文件路径过长:
手动修改了注册表下边这个键之后,安装成成功了。
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem路径下的变量 LongPathsEnabled, 将其置为 1即可.
具体见:volcengine-python-sdk[ark]~=1.0.94 # Solution for installation error in Windows: https://github.com/volcengine/volcengine-python-sdk/issues/5
2. 缓存文件损坏:
pip cache purge
命令清除缓存再 pip install -e .
参考链接: https://github.com/geekan/MetaGPT/blob/main/README.md
如果有任何问题,欢迎在评论区提问。
原文地址:https://blog.csdn.net/qq_41472205/article/details/144318944
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!