查看conda源,如何用conda查看鏡像源(Anaconda詳細(xì)教程)
最佳答案 問答題庫1338位專家為你答疑解惑
關(guān)于【查看conda源】,如何用conda查看鏡像源,今天犇涌小編給您分享一下,如果對您有所幫助別忘了關(guān)注本站哦。
內(nèi)容導(dǎo)航:1、查看conda源:Anaconda詳細(xì)教程2、查看conda源,如何用conda查看鏡像源1、查看conda源:Anaconda詳細(xì)教程
Anaconda介紹、安裝及使用教程
前言
Python是一種面向?qū)ο蟮慕忉屝陀?jì)算機(jī)程序設(shè)計(jì)語言,具有跨平臺(tái)的特點(diǎn),可以在Linux、macOS以及Windows系統(tǒng)中搭建環(huán)境并使用,其編寫的代碼在不同平臺(tái)上運(yùn)行時(shí),幾乎不需要做較大的改動(dòng)就能運(yùn)行。
Python的應(yīng)用遍及人工智能、科學(xué)計(jì)算、Web開發(fā)、系統(tǒng)運(yùn)維、大數(shù)據(jù)及云計(jì)算、金融、游戲開發(fā)等,具有數(shù)量龐大且功能相對完善的標(biāo)準(zhǔn)庫和第三方庫。
一、Anaconda
1、簡介
Anaconda是大型的科學(xué)計(jì)算平臺(tái),是Python集成開發(fā)環(huán)境,包含了大量的科學(xué)包,能夠方便快捷的對程序包進(jìn)行管理和部署。
2、特點(diǎn)
安裝簡單包含了數(shù)百個(gè)科學(xué)模塊,高效運(yùn)用于各種項(xiàng)目免費(fèi)社區(qū)支持Anaconda 是跨平臺(tái)的,有 Windows、macOS、Linux 版本支持多種語言:Python、R、Java等3、包管理工具——conda
3.1 升級(jí)
升級(jí)Anaconda需要先升級(jí)conda
condaupdatecondacondaupdateanacondacondaupdateanaconda-navigator#最新版本的anaconda-navigator
3.2 卸載
Linux、Mac 刪除安裝路徑
rm-rfanaconda
3.3 基本命令
conda--version#查看conda版本condaupdate-nbaseconda#update最新版本的condacondacreate-nxxxx#創(chuàng)建名為xxxx的虛擬環(huán)境condacreate-nxxxxpython=3.5#創(chuàng)建包含python3.5的名為xxxx的虛擬環(huán)境condaremove-nxxxx--all#刪除名為xxxx的虛擬環(huán)境condaactivatexxxx#進(jìn)入xxxx環(huán)境sourceactivatexxxxcondadeactivate#退出環(huán)境sourceactivatecondaenvlist#顯示所有的虛擬環(huán)境condainfo--envs#查看當(dāng)前環(huán)境condaclean-p#刪除沒有用的包c(diǎn)ondaclean-t#tar打包c(diǎn)ondaclean-y-all#刪除所有的安裝包及cache
3.4 對包的操作
condalist#查看所有已經(jīng)安裝的包c(diǎn)ondalist-nxxxx#指定查看xxxx虛擬環(huán)境下安裝的packagecondainstall-nxxxxxxx#在指定環(huán)境中安裝xxx包c(diǎn)ondaupdatexxx#更新包xxxcondauninstallxxx#卸載包xxx
3.5 鏡像源
condaconfig--show#查看已經(jīng)安裝過的鏡像源condaconfig--removechannelsurl#刪除url源condaconfig--addchannels#添加url源condaconfig--setshow_channel_urlsyes#從channel中安裝包時(shí)顯示channel的url
修改配置文件 ~/.condarc
channels:-https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/-https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/-https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/conda-forge/-defaultsshow_channel_urls:true
查看是否生效
condainfo
4、pip
4.1 基本命令
pip--version#查看版本pip--help#獲取幫助pipinstall-Upip#升級(jí)pippipinstallpkg#安裝包pipinstallpkg=version#安裝指定版本的包pipinstall--upgradepkg#升級(jí)包pipuninstallpkg#卸載包pipsearchpkg#搜索包pipshow#顯示安裝包信息pipshow-fpkg#查看指定包的詳細(xì)信息piplist#列出已安裝的包piplist-o#查看可升級(jí)的包
4、2 升級(jí)
Linux、Mac
pipinstall--upgradepip
windows
python-mpipinstall-Upip
4、3 鏡像源
臨時(shí)使用清華源
pipinstall-ihttps://pypi.tuna.tsinghua.edu.cn/simplesome-package
永久修改
Linux、Mac:~/.pip/pip.conf
windows:C:\Users\xx\pip\pip.ini
[global]index-url = https://pypi.tuna.tsinghua.edu.cn/simple# 阿里云 http://mirrors.aliyun.com/pypi/simple/ #?中國科技大學(xué) https://pypi.mirrors.ustc.edu.cn/simple/ #?豆瓣(douban) http://pypi.douban.com/simple/ #?清華大學(xué) https://pypi.tuna.tsinghua.edu.cn/simple/ #?中國科學(xué)技術(shù)大學(xué) http://pypi.mirrors.ustc.edu.cn/simple/[install]trusted-host = mirrors.aliyun.com
二、安裝
官網(wǎng)地址:https://www.anaconda.com/
1、Windows
安裝時(shí)一般默認(rèn)就行,在Advanced Installation Options這一步,不要勾選Add Anaconda to my PATH environment variable
2、Linux
命令行安裝
bash~/Downloads/Anaconda3-5.0.1-MacOSX-x86_64.sh安裝過程中,出現(xiàn)提示Press Enter to confirm the location, Press CTRL-C to cancel the installation or specify an alternate installation directory.如果接受默認(rèn)安裝路徑,則會(huì)顯示 PREFIX=/home/<user>/anaconda<2 or 3> 并且繼續(xù)安裝。出現(xiàn)提示Do you wish the installer to prepend the Anaconda install location to PATH in your /home/<user>/.bash_profile ?建議輸入yes。
3、Mac
前面直接下一步
在這,可以點(diǎn)擊Change Install Location來改變安裝位置。
完成!
點(diǎn)擊Anaconda-Navigator的圖標(biāo),打開
啟動(dòng)成功,說明安裝完成。
三、jupyter
1、notebook環(huán)境配置
1.1、Windows
打開控制面板->系統(tǒng)->高級(jí)系統(tǒng)設(shè)置->環(huán)境變量,選中系統(tǒng)變量中的path進(jìn)行添加
在Anaconda安裝位置下的的Script目錄及Library\bin目錄復(fù)制進(jìn)去,如
2、配置
2.1、生成配置文件
jupyternotebook--generate-config
2.2、設(shè)置密碼
jupyternotebookpassword#這步設(shè)置的密碼用于瀏覽器訪問時(shí)輸入
2.3、修改配置文件
Windows
C:\Users\Administrator\.jupyter\jupyter_notebook_config.py
Linux、Mac
vim~/.jupyter/jupyter_notebook_config.py
#前面的#去掉c.NotebookApp.ip='*'#開啟所有的IP訪問,即可使用遠(yuǎn)程訪問c.NotebookApp.open_browser=False#關(guān)閉啟動(dòng)后的自動(dòng)開啟瀏覽器c.NotebookApp.port=8888#設(shè)置端口8888,也可用其他的,比如1080,8080等等c.NotebookApp.notebook_dir=’‘#設(shè)置notebook默認(rèn)打開的目錄c.PAMAuthenticator.encoding='utf8'#指定utf-8編碼,解決讀取中文路徑或者文件亂碼問題
2.4、啟動(dòng)notebook
jupyternotebook#啟動(dòng)notebookjupyterlab#啟動(dòng)lab
2.5 遠(yuǎn)程登錄
啟動(dòng)notebook之后在瀏覽器中輸入啟動(dòng)是打印的網(wǎng)址或者:
localhost:port/tree#進(jìn)入jupyternotebooklocalhost:port/lab#進(jìn)入jupyterlab
jupyter在服務(wù)器服務(wù)器,想在本地瀏覽器訪問時(shí),需要在終端輸入命令
ssh-N-Llocalhost:7777:login-0-0.local:12315dengxsh4490@10.100.2.10
注:localhost:7777指定本地瀏覽器需要輸入的地址,login-0-0.local:12315代表服務(wù)器運(yùn)行jupyter時(shí)打印的輸出信息中的地址
3、jupyter kernel
3.1 擴(kuò)展 R kernel
install.package('IRkernel')#displayname指定jupyter中顯示的名字IRkernel::installspec(name='ir32',displayname='R3.2')
3.2 查看kernel
jupyterkernelspeclist
3.3 卸載指定kernel
jupyterkernelspecremovekernel_name
四、jupyter 插件
1、jupyter notebook 插件
1.1、安裝并激活 jupyter_contrib_nbextensions
pipinstalljupyter_contrib_nbextensionsjupytercontribnbextensioninstall--user
1.2、 安裝并啟用 Jupyter Nbextensions Configurator
pipinstalljupyter_nbextensions_configuratorjupyternbextensions_configuratorenable--user
1.3、conda安裝的方式
condainstall-cconda-forgejupyter_contrib_nbextensionscondainstall-cconda-forgejupyter_nbextensions_configurator
可替代1.1和1.2
完成后,在啟動(dòng) jupyter notebook后可在瀏覽器菜單欄中多了一欄
選中想要的插件即可添加
1.4、插件選擇
Variable Inspector:這是一個(gè)查看變量的插件
Table of Contents:自動(dòng)生成目錄插件
Table of Contents:自動(dòng)生成目錄插件
Codefolding:代碼折疊
Autopep8:自動(dòng)代碼格式優(yōu)化
AutoSaveTime:控制腳本的自動(dòng)保存時(shí)間
Hide Input All: 隱藏所有的代碼單元,保持所有的輸出和 markdown 單元可見
Spellchecker: 對 markdown 單元中的內(nèi)容進(jìn)行拼寫檢查
插件很多,可根據(jù)需要添加
2、jupyter lab插件
介紹幾款好用的插件
注:安裝這些插件需要先安裝 node,并將node添加到環(huán)境變量中。安裝時(shí)請注意node版本
2.1、toc
這是一個(gè)目錄插件,安裝后就能很方便地在Lab上展示notebook或者markdown的目錄。目錄可以滾動(dòng),并且能展示或隱藏子目錄。
https://link.zhihu.com/?target=https%3A//github.com/jupyterlab/jupyterlab-toc
2.2、LaTeX
支持在線編輯并預(yù)覽LaTeX文檔。
https://link.zhihu.com/?target=https%3A//github.com/jupyterlab/jupyterlab-latex
2.3、drawio
可以在Lab中啟用drawio繪圖工具,是一款非常棒的流程圖工具。
https://link.zhihu.com/?target=https%3A//github.com/QuantStack/jupyterlab-drawio
2.4、variableinspector
該插件可以在Lab中展示代碼中的變量及其屬性,類似RStudio中的變量檢查器。
https://link.zhihu.com/?target=https%3A//github.com/lckr/jupyterlab-variableInspector
2.5、go to Definition
該插件用于在Lab筆記本和文件編輯器中跳轉(zhuǎn)到變量或函數(shù)的定義。
https://link.zhihu.com/?target=https%3A//github.com/krassowski/jupyterlab-go-to-definition
2.6、lsp
該插件用于自動(dòng)補(bǔ)全、參數(shù)建議、函數(shù)文檔查詢、跳轉(zhuǎn)定義等。
https://link.zhihu.com/?target=https%3A//github.com/krassowski/jupyterlab-lsp
2.7 spreadsheet
該插件用于在Lab上顯示excel表格,只讀
https://link.zhihu.com/?target=https%3A//github.com/quigleyj97/jupyterlab-spreadsheet
2.8、debugger
可用于試調(diào)
condainstallxeus-python=0.8.0-cconda-forgejupyterlabextensioninstall@jupyterlab/debugger
https://github.com/jupyterlab/debugger
2.9、matplotlib、dash、plotly等可交互式繪圖
幫助我們在notebook界面配合matplotlib實(shí)現(xiàn)交互式的作圖,只需要在繪圖之前執(zhí)行魔法命令%matplotlib widget
matplotlib:https://github.com/matplotlib/ipympl
plotly:https://github.com/plotly/plotly.py
2.10、kite
在jupyter lab使用kite代碼補(bǔ)全服務(wù)
https://github.com/kiteco/jupyterlab-kite
2、查看conda源,如何用conda查看鏡像源
軟件安裝是生信分析的基礎(chǔ),除了掌握基本的軟件安裝理論外之后 (Linux - 命令運(yùn)行監(jiān)測和軟件安裝),就是去下載源碼安裝或使用包管理工具安裝通常操作都沒問題時(shí),軟件卻怎么都裝不上,這一般都是網(wǎng)絡(luò)問題所以你需要一個(gè)能夠快速訪問的鏡像,下載快還不容易斷,今天小編就來說說關(guān)于如何用conda查看鏡像源?下面更多詳細(xì)答案一起來看看吧!

如何用conda查看鏡像源
軟件安裝是生信分析的基礎(chǔ),除了掌握基本的軟件安裝理論外之后 (Linux - 命令運(yùn)行監(jiān)測和軟件安裝),就是去下載源碼安裝或使用包管理工具安裝。通常操作都沒問題時(shí),軟件卻怎么都裝不上,這一般都是網(wǎng)絡(luò)問題。所以你需要一個(gè)能夠快速訪問的鏡像,下載快還不容易斷。
國內(nèi)的鏡像比較全的有清華鏡像 (https://mirrors.tuna.tsinghua.edu.cn)和阿里云鏡像 (https://developer.aliyun.com/mirror/)。下面以清華鏡像為例 (阿里云鏡像沒有conda),展示下其操作。
Conda鏡像Conda增加清華的鏡像,運(yùn)行下面的代碼 (后添加的通道優(yōu)先級(jí)更高)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/mainconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freeconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/rconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/proconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2conda 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/bioconda/
或直接把下面文字拷貝到 ~/.condarc中 (越靠前的優(yōu)先級(jí)越高)
channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
Python包管理工具 pip鏡像可以每次安裝時(shí)加-i參數(shù) (或使用alias命令)。
注意,simple不能少, 是https而不是 http。
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
升級(jí) pip 到最新的版本 (>=10.0.0) 后進(jìn)行永久配置:
pip install pip -Upip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
R包安裝鏡像CRAN和Bioconductor的鏡像
安裝前現(xiàn)運(yùn)行這幾句話,或把這幾句話放在~/.Rprofile或~/.Profile.site文件下 (Windows里面的路徑是C:\Program Files\R\R-3.6.1\etc)。
local({r <- getOption("repos")r["CRAN"] <- "http://mirrors.tuna.tsinghua.edu.cn/CRAN/"options(repos=r)})options(BioC_mirror="https://mirrors.tuna.tsinghua.edu.cn/bioconductor")
自動(dòng)安裝包
# 安裝BiocManagerif (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager")# 獲取已安裝包a = rownames(installed.packages())install_package <- c("RColorBrewer", "gplots", "agricolae","optparse")# 判斷包是否存在,不存在則安裝for (i in install_package) { if (!i %in% a) BiocManager::install(i, update = F)}
如果是Github的包安裝起來比較慢,可以考慮在碼云(https://gitee.com/)注冊個(gè)賬戶,把`Github`的庫先克隆到碼云 (點(diǎn)擊幾下就可以實(shí)現(xiàn),碼云的服務(wù)器訪問Github還是很快的),然后再下載到本地安裝即可。
HomeBrewMac下默認(rèn)的不少Linux命令如awk, sed,cat等與Linux下使用方式有些差別,通常需要安裝GNU系列的對應(yīng)命令來統(tǒng)一代碼操作??梢酝ㄟ^brew安裝,但brew update過程默認(rèn)是極其的慢,也需要改一下鏡像。
安裝Brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
配置鏡像
# brew 程序本身,Homebrew/Linuxbrew 相同git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git# 索引的鏡像# 以下針對 mac OS 系統(tǒng)上的 Homebrewgit -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.gitgit -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.gitgit -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.gitgit -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git# 更換后測試工作是否正常brew update# 軟件包的鏡像echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profilesource ~/.bash_profile
安裝相應(yīng)的gnu系列工具
#brew install bashbrew install coreutilsbrew install gawkbrew install gnu-sed
其它鏡像還有其它鏡像,如Perl的CPAN,Linux操作系統(tǒng)安裝包,Linux操作系統(tǒng)自帶包管理工具(yum/apt)的源,Docker鏡像等。
本文關(guān)鍵詞:設(shè)置conda源,查看conda路徑,conda版本怎么看,conda配置源,查看conda的環(huán)境。這就是關(guān)于《查看conda源,如何用conda查看鏡像源(Anaconda詳細(xì)教程)》的所有內(nèi)容,希望對您能有所幫助!更多的知識(shí)請繼續(xù)關(guān)注《犇涌向乾》百科知識(shí)網(wǎng)站:!
99%的人還看了
猜你感興趣
版權(quán)申明
本文" 查看conda源,如何用conda查看鏡像源(Anaconda詳細(xì)教程)":http://eshow365.cn/3-2779-0.html 內(nèi)容來自互聯(lián)網(wǎng),請自行判斷內(nèi)容的正確性。如有侵權(quán)請聯(lián)系我們,立即刪除!