赞
踩
目录
第一步:进入官网:Visual Studio: IDE and Code Editor for Software Developers and Teams下载社区版
打开ancona prompt命令窗口
使用anaconda进行安装rasa:
1 anaconda 命令创建python版本为X.X、名字为rasaEnv的虚拟环境。
conda create -n rasaEnv python=3.7
注意:使用pip安装Rasa开放源码(需要Python3.7或3.8)。
使用命令,查看安装情况:
conda info --env
activate rasaEnv
为增加下载速度,提前在anaconda中,在刚刚激活的rasa环境中,配置清华镜像源
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
-
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- conda config --set show_channel_urls yes
或者在文件夹目录C:\Users\用户名.condarc,进行配置
- <span style="background-color:var(--code-block-bg-color)"><span style="color:#a9b7c6">channels:
-
- - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- - defaults
- show_channel_urls: true</span></span>
执行安装命令
注意:安装过程会自动安装keras 、tensorflow
pip install rasa
在线安装mitie时,成功率太低,且在rasa训练过程中,容易报错,故在安装mitie之前安装visual Studio。具体步骤如下:
1 因为我不涉及其他的开发,我只选择了基础的C++开发工具。
2 单击【单个组件】,勾选 用于 CMake 的 Visual C++ 工具
3 安装位置,点击安装。
我把软件安装在d盘,故需要把以下路径添加到系统变量中,参照自己的安装位置,找到如下所示的路径。
D:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin
执行以下命名:
pip install dlib -i https://pypi.douban.com/simple
具体为:
- (d:\Anaconda3) C:\Users\xxxx>activate rasaEnv
- (rasaEnv) C:\Users\xxxx>pip install dlib -i https://pypi.douban.com/simple
该过程没有显示进度,时间过长。完成后如下图所示:
- pip install git+git://github.com/mit-nlp/MITIE.git
- pip install rasa[mitie] # 注:由于第一步始终没成功过,没尝试过这个命令的意义
在安装mite时容易出现错误,我在安装过程中出现了以下错误
- ERROR: Command errored out with exit status 1:
- 'd:\anaconda3\envs\rasaEnv\python.exe'
- -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\yangwei\\AppData\\Local\\Temp\\pip-req-build-sgnk4ea2\\setup.py'"'"'; __file__='"'"'C:\\Users\\yangwei\\AppData\\Local\\Temp\\pip-req-build-sgnk4ea2\\setup.py'"'"';
- f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');
- code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');
- f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\yangwei\AppData\Local\Temp\pip-record-xistd_ix\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\anaconda3\envs\rasaEnv\Include\mitie' Check the logs for full command output.
mite地址:mirrors / mit-nlp / MITIE · GitCode
解压mite源码文件到任意目录,这里我把mite解压文件放在了和rasaEnv的同目录下,方便管理。
进入mite目录位置,依次执行命令:
- python setup.py build
- python setup.py install
注意:jieba、rasa_core、rasa_nlu等即可以安装需求分别安装,但这样比较麻烦,建议直接跳过4、5、6。rasa提供了一次性安装的命令,具体为步骤7,在步骤7里,将会用一条命令将这个依赖的库,一次性安装,描述jieba、rasa_core、rasa_nlu等安装过程,只是保证文档完整性。
-
- pip install jieba -i Simple Index --trusted-host pypi.douban.com
推荐的安装Rasa Core的方法是使用pip:
pip install rasa_core
要是出现报错
则换个镜像
解决措施:
pip install rasa_core -i https://pypi.douban.com/simple
我们使用Rasa NLU进行意图分类和实体提取。为了得到它,运行
pip install rasa_nlu -i https://pypi.douban.com/simple
对于某些机器学习算法,您需要安装额外的 python 包。 默认情况下不安装它们以保持占用空间小。 你要是不介意下载更多的库,可以使用下面命名一次性安装所有的rasa依赖库。
pip install rasa[full] -i https://pypi.douban.com/simple
如图所示先切换到rasa环境中,再执行命令。
<span style="background-color:var(--code-block-bg-color)"><span style="color:#a9b7c6">ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. rasa-nlu 0.15.1 requires cloudpickle~=0.6.1, but you have cloudpickle 1.6.0 which is incompatible. rasa-nlu 0.15.1 requires jsonschema~=2.6, but you have jsonschema 3.2.0 which is incompatible. rasa-nlu 0.15.1 requires matplotlib~=2.2, but you have matplotlib 3.3.4 which is incompatible. rasa-nlu 0.15.1 requires packaging~=18.0, but you have packaging 20.9 which is incompatible. rasa-nlu 0.15.1 requires ruamel.yaml~=0.15.7, but you have ruamel-yaml 0.16.13 which is incompatible. rasa-nlu 0.15.1 requires scikit-learn~=0.20.2, but you have scikit-learn 0.24.2 which is incompatible. rasa-core 0.14.5 requires fbmessenger~=5.0, but you have fbmessenger 6.0.0 which is incompatible. rasa-core 0.14.5 requires jsonschema~=2.6, but you have jsonschema 3.2.0 which is incompatible. rasa-core 0.14.5 requires packaging~=18.0, but you have packaging 20.9 which is incompatible. rasa-core 0.14.5 requires python-socketio~=3.0, but you have python-socketio 5.5.2 which is incompatible. rasa-core 0.14.5 requires pytz~=2018.9, but you have pytz 2021.3 which is incompatible. rasa-core 0.14.5 requires redis~=2.0, but you have redis 3.5.3 which is incompatible. rasa-core 0.14.5 requires ruamel.yaml~=0.15.0, but you have ruamel-yaml 0.16.13 which is incompatible. rasa-core 0.14.5 requires scikit-learn~=0.20.0, but you have scikit-learn 0.24.2 which is incompatible. rasa-core 0.14.5 requires slackclient~=1.0, but you have slackclient 2.9.3 which is incompatible. rasa-core 0.14.5 requires tensorflow~=1.13.0, but you have tensorflow 2.6.1 which is incompatible.</span></span>
要是出现以上错误提示,则升级rasa,
pip3 install --upgrade rasa
再执行
pip install rasa[full] -i https://pypi.douban.com/simple
新建一个工程,选择python环境,如下图所示。
工程文件建立完成后,即可查看rasa版本:
打开prcharm Terminal 输入命令rasa init,使用示例训练数据为你建立一个完整的项目。
rasa init
执行过程中,会自动创建项目所需的文件目录:
然后按照提示,输入“y”,继续执行即可,完成后,输入对话内容:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。