Python 機器學習第一章環(huán)境配置圖解流程
本文主要是分享一下機器學習初期,基本的環(huán)境搭建。也適用于其他python工程化項目環(huán)境搭建。都差不多。
Anaconda安裝
anaconda官方鏈接:Anaconda | The World's Most Popular Data Science Platform
點擊Get Started
點擊Download Anaconda installers
根據自己的操作系統(tǒng),下載對應的安裝包。
安裝anaconda
一路點下去,安裝完成。
使用conda配置python3.6環(huán)境
目前python3比較穩(wěn)定的版本為3.6,通過anaconda構建一個python3的虛擬環(huán)境。
首先我們看一下base環(huán)境的python版本。點開windows的搜索欄,輸入anaconda,打開Anaconda Prompt。
輸入命令
conda create -n pytorch python=3.6
構建一個叫pytorch的虛擬環(huán)境。并且激活環(huán)境,輸入一下命令。
Spyder配置與使用
Pycharm整體來看還是python最好的IDE,Spyder是Anaconda提供的IDE,是我認為在編輯一些簡單程序、或者調試程序比較好用的IDE。這里推薦一下。
打開Anaconda Navigator。
升級一下,并且切換一下我們剛剛激活的pytorch環(huán)境。
打開Spyder
可以選中部分代碼,按F9,只執(zhí)行選中的代碼塊,很適合調試。
安裝PyTorch
登入PyTorch官網:PyTorch
選擇操作系統(tǒng),cuda模式,復制安裝命令。
Anaconda Prompt激活pytorch環(huán)境,執(zhí)行命令。慢慢等安裝吧。
如果你發(fā)現安裝很慢的話,建議給anaconda添加國內源。而且我不建議是清華源,因為太卡了。這里推薦一下北外的源。具體操作如下:
打開用戶目錄下的.condarc文件,更新成為如下內容。
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud
msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud
bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud
menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud
pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud
simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud
命令行中執(zhí)行命令清理緩存。
conda clean -i
安裝完成之后,查看pytorch版本。
conda list
總結
基本環(huán)境已經搭好了,找個模型玩玩吧。
如果本文對你有幫助的話,點個贊吧。
到此這篇關于Python 機器學習第一章環(huán)境配置圖解流程的文章就介紹到這了,更多相關Python 機器學習內容請搜索本站以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持本站!
版權聲明:本站文章來源標注為YINGSOO的內容版權均為本站所有,歡迎引用、轉載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網站,禁止在非www.sddonglingsh.com所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內容來源于網友推薦、互聯網收集整理而來,僅供學習參考,不代表本站立場,如有內容涉嫌侵權,請聯系alex-e#qq.com處理。