今天在centos7下安裝了Anaconda,將安裝過程記錄如下
下載安裝Anaconda
下載地址:https://repo.continuum.io/archive/index.html
打開頁面后,以Anaconda2開頭的就是python2版本,以Anaconda3開頭的就是python3版本,因為centos7本身就帶有python2.7版本,所有我下載的是Anaconda3 比較新的版本 Anaconda3-5.1.0-Linux-x86_64.sh
右鍵復制下載鏈接地址 https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh,命令行輸入:
wget https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
如果提示錯誤:-bash: wget: command not found,則先執行如下命令后再執行上一條命令
yum -y install wget
執行完 wget 命令后會下載Anaconda sh文件到當前目錄下,執行命令進行安裝
bash <span style="color:rgb(0,0,0);font-family:Consolas, 'Courier New', Courier, mono, serif;font-size:12px;text-align:left;">Anaconda3-5.1.0-Linux-x86_64.sh</span>
如果安裝過程中提示錯誤:bunzip2: command not found,先執行命令再安裝
yum install -y bzip2
接下來就等着安裝完畢,中間會有提示讓你確認,按以下輸入就行了
Do you accept the license terms? [yes|no]
[no] >>> yes
Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /home/ai/.bashrc ? [yes|no]
[no] >>> yes
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
>>> no
中間還會讓你指定一個安裝目錄,可以用默認的回車就行了,也可以自己指定一個目錄,注意,指定的目錄不能已經存在,他會自動創建,我指定的是 /usr/local/Anaconda3
安裝完畢之后,需要重新啟動命令行終端,anaconda才能生效。
驗證是否安裝成功
conda -V
分別輸入python python2 python3命令如下圖
可以看到python2.7和python3.6都裝上了,python和python3命令對應的python版本為3.6,python2命令對應的python版本是2.7。
如果安裝過程中出錯問題,或者想更新另一個版本,刪除anaconda也很方便,執行下面命令刪除安裝目錄就行了
rm -rf /usr/local/Anaconda3
====================================================================================================================================
1.
下載並安裝anaconda
地址:https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
安裝:bash Anaconda3-2019.03-Linux-x86_64.sh
2.
創建並激活一個虛擬環境
創建:conda create -p /path/machinelearning
激活:conda activate /path/machinelearning
3.
在虛擬環境目錄下分別建立子目錄:/model/singleTurnIntent和/model/singleTurnSlot
將意圖識別模型和槽填充模型分別拷貝至上述兩個目錄中。
4.
將singleTurnIntentSlotPredict.py拷貝至/machinelearning目錄中。
5.
安裝以下庫:
pip install spacy --
pip install pandas
pip install tensorflow
pip install flask
pip install waitress
pip install tflearn
pip install flask_cors
pip install jieba
6.
啟動服務:
進入/machinelearning目錄中,執行下面的語句:
nohup python -u singleTurnIntentSlotPredict.py>out.log &