從各種主流的軟件安裝anaconda,卻不知道這個是什么用的,只把他當作包的集合,library的library顯然是只用了最基礎的功能。很多代碼嚴格限制了安裝包版本,那么利用anconda就可以隨意配置,隨意切換,再也不擔心服務器了。下面以protobuf,libprotobuf為例說明問題。
所以現在開始用:
1.換源
首先,要換個軟件源,要不更新下載都要科學上網才能下,所以在我國的網必須換。
https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
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 --set show_channel_urls yes
2.建立環境
conda info --envs
conda create --name proto351 protobuf
如果你換了鏡像的源的話就會有下面的地址。
否則就是這樣的:
最后不得不取消。
好 ,接下來看看他裝了什么:
source activate proto351
conda list
然后我的命令行就變成了前面有個(proto351)的樣子:
安裝特定版本
如果要安裝特定版本的protobuf,記住了包要用等號指定版本
conda create --name proto261 protobuf==2.6.1
那么問題來了:為什么其他包的位置都變了,這個protobuf還是陰魂不散???
安裝libprotobuf才能改變protoc的版本與位置
conda search libprotobuf conda install libprotobuf=2.5.0
這時你再問版本,你就會發現,變了: