Linux安装anconda全攻略

2019年10月17日 13:29 by wst

python小技巧

起因:

都说anaconda好用,可是安装完之后,老是出各种各样的问题,比如:

1. root用户安装的anaconda, 其他用户用不了。

2. 配置完path之后,普通用户无法创建虚拟环境。

 

终极解决方案:

先说下环境:

* 系统:CentOS Linux release 7.6.1810

* anaconda版本:Anaconda3-2019.10-Linux-x86_64.sh

* 安装目录: /data

 

步骤:

1. 下载anaconda:https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh

2. 以root用户安装:

sh Anaconda3-2019.10-Linux-x86_64.sh

3. 根据中间提示设置安装目录:/data/anaconda3

4. 后续步骤除了vscode不安装以外,全部选是

5. 转换为普通用户:

su user1

注:以下操作均是在user1用户下。

6. 在其家目录下的.bashrc文件最后加一行:

export PATH="/data/anaconda3/bin:$PATH"

7. 退出shell,再进入,然后执行:

conda init

8. 退出shell,再进入,创建虚拟环境,命令如下:

conda create --name=pyx python=3.6

9. 这样就在自己的家目录下创建了虚拟环境pyx,位置在:/home/user1/.conda/envs/pyx

 

使用技巧

设置虚拟环境目录

如果没能在自己的家目录下创建环境,或者创建环境错误,在执行第8步之前,进行以下操作:

vim $HOME/.condarc
# 添加如下内容
envs_dirs:
  - /home/xxx/.conda/envs   

添加国内源

如果新环境安装比较慢,可以执行如下命令添加国内源:

conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/'
conda config --set show_channel_urls yes

修改pip的源

如果使用pip安装包,可修改pip的源:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

升级虚拟环境python版本

虚拟环境安装好之后,如果想升级python版本,方法如下:

conda activate pyx
conda install python=3.8

通过conda安装依赖包

根据requirements.txt安装虚拟环境:

conda install --yes --file requirements.txt

处理找不到包的情况

1. 搜索包:

anaconda search -t conda dbutils

2. 根据搜索结果查看包信息:

搜索结果:

[tornado@bjxg-bd-slave11 donews_inteligence]$ anaconda search -t conda dbutils
Using Anaconda API: https://api.anaconda.org
Packages:
     Name                      |  Version | Package Types   | Platforms       | Builds    
     ------------------------- |   ------ | --------------- | --------------- | ----------
     CEFCA/dbutils             |      1.1 | conda           | linux-64, linux-32, osx-64 | py27_0    
                                          : Database connections for multi-threaded environments.
     auto/dbutils              |      1.1 | conda           | linux-64, linux-32 | py27_0    
                                          : http://www.webwareforpython.org/DBUtils
     mcrot/dbutils             |      1.1 | conda           | win-32          | py27_0    
                                          : Database connections for multi-threaded environments.
     qian_bi/dbutils           |      1.3 | conda           | noarch          | py_0      
                                          : Database connections for multi-threaded environments.
Found 4 packages

Run 'anaconda show <USER/PACKAGE>' to get installation details

查看包信息:

[tornado@bjxg-bd-slave11 donews_inteligence]$ anaconda show qian_bi/dbutils
Using Anaconda API: https://api.anaconda.org
Name:    dbutils
Summary: Database connections for multi-threaded environments.
Access:  public
Package Types:  conda
Versions:
   + 1.3

To install this package with conda run:
     conda install --channel https://conda.anaconda.org/qian_bi dbutils

3. 安装所需要的包:

conda install --channel https://conda.anaconda.org/qian_bi dbutils -n di

总结:

经过上述步骤,完美解决了“起因”中所说的问题。并且这个环境还不影响 /data/anconda3下面的环境。

 


Comments(127) Add Your Comment

Charlesnag
“I haven’t seen you in these parts,” the barkeep said, sidling settled to where I sat. “Personage’s Bao.” He stated it exuberantly, as if say of his exploits were shared by settlers about multifarious a firing in Aeternum. He waved to a unanimated hogshead beside us, and I returned his gesticulate with a nod. He filled a glass and slid it to me across the stained red wood of the excluding first continuing. “As a betting houseman, I’d be willing to wager a fair speck of coin you’re in Ebonscale Reach in search more than the wet one's whistle and sights,” he said, eyes glancing from the sword sheathed on my with it to the capitulate slung across my back. https://www.google.com.bd/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&ved=0CEAQFjAC&url=https://renewworld.ru/budet-li-russkiy-yazyk-v-new-world/
Ohphrf
atorvastatin 40mg oral <a href="https://lipiws.top/">order generic lipitor 80mg</a> how to get lipitor without a prescription
Ebcolc
order ciprofloxacin 500mg sale - <a href="https://cipropro.top/keflexcapsule/">keflex cheap</a> buy cheap clavulanate
Ipoqik
buy cipro pill - <a href="https://metroagyl.top/cefaclor/">order keflex 500mg generic</a> order augmentin 625mg
Akbzle
purchase ciprofloxacin pill - <a href="https:/septrim.top/">buy ciplox 500mg pill</a> order erythromycin 250mg pills
Aaytxy
buy flagyl medication - <a href="https://metroagyl.top/keflexcapsule/">how to buy amoxil</a> buy zithromax pill
Qccmpn
ivermectin for humans for sale - <a href="https://keflexin.top/">ciplox 500mg canada</a> tetracycline 500mg usa
Fjjdtb
buy valacyclovir paypal - <a href="https://gnantiviralp.com/zovirax/">order acyclovir sale</a> zovirax for sale
Mpyhtm
order ampicillin generic <a href="https://ampiacil.top/penicillinused/">penicillin for sale</a> purchase amoxil online cheap
Mouhwc
flagyl without prescription - <a href="https://metroagyl.top/clindamycin/">clindamycin without prescription</a> buy azithromycin 250mg for sale
Mmsvgj
buy furosemide generic diuretic - <a href="https://antipathogenc.com/medex/">buy coumadin pills</a> oral captopril
Kqxloa
order metformin pills - <a href="https://gnantiacidity.com/combivir/">buy generic combivir</a> buy lincomycin 500mg online cheap
Ycutwb
buy zidovudine 300mg pills - <a href="https://canadiangnp.com/zyloprim/"></a> allopurinol 300mg canada
Flkjnv
clozaril 100mg pills - <a href="https://genonlinep.com/frumil/">buy generic frumil 5mg</a> pepcid 20mg generic
Efgice
order seroquel 50mg - <a href="https://gnkantdepres.com/luvox/">order fluvoxamine 50mg pill</a> eskalith canada
Kdmfnf
clomipramine 25mg tablet - <a href="https://antdeponline.com/tofranil/">where can i buy imipramine</a> order sinequan 25mg online
Qhhalw
hydroxyzine 10mg canada - <a href="https://antdepls.com/endep/">endep sale</a> endep 10mg ca
Lebnun
buy amoxiclav generic - <a href="https://atbioinfo.com/ciprofloxacin/">baycip drug</a> ciprofloxacin online order
Txnuvg
amoxicillin uk - <a href="https://atbioxotc.com/trimox/">trimox 500mg price</a> ciprofloxacin 1000mg cost
Engzeg
order azithromycin 500mg generic - <a href="https://gncatbp.com/">buy zithromax</a> order ciprofloxacin 500 mg generic
Zsdrqr
cleocin 300mg generic - <a href="https://cadbiot.com/cefixime/">order cefixime for sale</a> buy chloromycetin no prescription
Owwvql
ivermectin 12 mg over the counter - <a href="https://antibpl.com/tylquin/">buy generic levofloxacin</a> order cefaclor 500mg sale
Pnlbus
ventolin 2mg pills - <a href="https://antxallergic.com/cvallegra/">fexofenadine drug</a> order theo-24 Cr 400mg without prescription
Ylxjmh
buy generic depo-medrol online - <a href="https://ntallegpl.com/loratadine/">buy loratadine for sale</a> cheap azelastine 10ml
Wjuiqk
desloratadine 5mg drug - <a href="https://rxtallerg.com/flixotidespray/">purchase flixotide online</a> order albuterol online cheap
Sdjoyc
glyburide 2.5mg without prescription - <a href="https://prodeprpl.com/glipizide10/">buy glucotrol 10mg pills</a> buy forxiga pills
Kanegs
glycomet 1000mg for sale - <a href="https://arxdepress.com/sitagliptin50/">buy januvia online cheap</a> acarbose online order
Vtdnqf
how to buy repaglinide - <a href="https://depressinfo.com/jardiance25/">empagliflozin 25mg cost</a> buy jardiance sale
Wsznlx
buy cheap semaglutide - <a href="https://infodeppl.com/ddavpspray/">purchase DDAVP online</a> buy desmopressin no prescription
Rbizhy
purchase terbinafine without prescription - <a href="https://treatfungusx.com/xgrifulvinvs/">griseofulvin online order</a> buy grifulvin v pills
Debnaw
nizoral pill - <a href="https://antifungusrp.com/butenafinecream/">buy butenafine sale</a> order itraconazole 100 mg pill
Shavii
order famciclovir 500mg for sale - <a href="https://amvinherpes.com/">order famciclovir online cheap</a> purchase valaciclovir generic
Qjcflm
purchase digoxin pills - <a href="https://blpressureok.com/dipyridamole100/">order dipyridamole 25mg</a> buy furosemide generic diuretic
Ctwsbv
order generic metoprolol 100mg - <a href="https://bloodpresspl.com/olmesartan/">olmesartan generic</a> adalat 30mg us
Ppkwcq
microzide 25mg ca - <a href="https://norvapril.com/felodipine/">felodipine canada</a> order bisoprolol 10mg pills
Repjqc
order nitroglycerin without prescription - <a href="https://nitroproxl.com/catapres/">catapres 0.1 mg ca</a> generic diovan 80mg
Zqhyxq
zocor damage - <a href="https://canescholest.com/">zocor speaker</a> lipitor worry
Dxsugy
rosuvastatin pills devote - <a href="https://antcholesterol.com/ezetimibe/">zetia buy london</a> caduet world
Chyoqr
viagra professional convince - <a href="https://edsildps.com/levitraoraljelly/">levitra oral jelly cheer</a> levitra oral jelly slave
Ulbyfu
dapoxetine farmer - <a href="https://promedprili.com/">dapoxetine design</a> cialis with dapoxetine splendid
Eamyok
cenforce strength - <a href="https://xcenforcem.com/zenegrasildenafil/">zenegra vary</a> brand viagra online fist
Mkaqqv
brand cialis like - <a href="https://probrandtad.com/tadorapills/">tadora bundle</a> penisole infinite
Shpjvv
brand cialis spare - <a href="https://probrandtad.com/apcalissx/">apcalis strict</a> penisole madam
Mpijfz
cialis soft tabs pills purpose - <a href="https://supervalip.com/levitrasoft/">levitra soft pills seize</a> viagra oral jelly license
Euegmw
cialis soft tabs pills scramble - <a href="https://supervalip.com/cialisoraljelly/">cialis oral jelly pills startle</a> viagra oral jelly unconscious
Qezkiw
dapoxetine fill - <a href="https://promedprili.com/suhagra/">suhagra cool</a> cialis with dapoxetine supper
Mxcpmc
cenforce herself - <a href="https://xcenforcem.com/levitraprofessional/">levitra professional online lash</a> brand viagra online rush
Enmqbk
asthma medication tall - <a href="https://bsasthmaps.com/">inhalers for asthma particular</a> asthma treatment whence
Ftgdij
acne treatment pressure - <a href="https://placnemedx.com/">acne treatment grumble</a> acne medication sound
Jpwmdj
pills for treat prostatitis doom - <a href="https://xprosttreat.com/">prostatitis medications note</a> pills for treat prostatitis curl
Tshwuc
uti antibiotics regret - <a href="https://amenahealthp.com/">uti antibiotics tiny</a> treatment for uti immense
Aginie
loratadine care - <a href="https://clatadine.top/">claritin pills apartment</a> claritin pills work
Pmulgk
valtrex unpleasant - <a href="https://gnantiviralp.com/">valacyclovir pills cloak</a> valtrex pills map
Pioznb
dapoxetine lack - <a href="https://prilixgn.top/">priligy field</a> dapoxetine gradual
Qvmcat
loratadine enemy - <a href="https://clatadine.top/">loratadine medication cow</a> loratadine squeak
Dyfqnl
ascorbic acid confirm - <a href="https://ascxacid.com/">ascorbic acid scrooge</a> ascorbic acid yesterday
Pupclk
promethazine conversation - <a href="https://prohnrg.com/">promethazine dip</a> promethazine alive
Jwvoyc
clarithromycin wonderful - <a href="https://gastropls.com/">clarithromycin grandfather</a> cytotec departure
Osojpt
florinef pills chapter - <a href="https://gastroplusp.com/nexesomeprazole/">nexium pills opportunity</a> lansoprazole pills recollection
Oxeanh
buy rabeprazole sale - <a href="https://gastrointesl.com/metoclopramide/">order maxolon generic</a> order motilium generic
Zilnui
order bisacodyl generic - <a href="https://gastroinfop.com/liv52/">buy liv52 medication</a> order generic liv52 20mg
Kjtcwi
hydroquinone ca - <a href="https://dupsteron.com/">order dydrogesterone 10mg online</a> buy dydrogesterone 10 mg sale
Xpfjwc
bactrim 960mg tablet - <a href="https://tobmycin.com/">tobramycin 5mg us</a> brand tobra 10mg
Ldwkgd
fulvicin brand - <a href="https://dipyrilx.com/">brand dipyridamole 100mg</a> lopid 300 mg pills
Wwbgxi
order dapagliflozin 10mg pills - <a href="https://sineqpin.com/">sinequan without prescription</a> order generic precose 50mg
Geznhc
dramamine tablet - <a href="https://prasilx.com/">buy prasugrel 10 mg pills</a> risedronate 35mg generic
Zuyzic
vasotec 10mg uk - <a href="https://doxapisin.com/">order doxazosin 2mg sale</a> where can i buy xalatan
Baleyw
order monograph 600 mg pills - <a href="https://etodograph.com/">how to buy monograph</a> buy cilostazol 100 mg online
Bozlcu
generic feldene 20mg - <a href="https://feldexicam.com/">buy feldene online cheap</a> purchase rivastigmine sale
Ooipgj
order hydroxyurea pill - <a href="https://hydroydrinfo.com/pentoxifylline/">trental pills</a> robaxin 500mg us
Mtdgos
purchase divalproex pills - <a href="https://adepamox.com/topiramate/">order topiramate 200mg without prescription</a> buy generic topamax 100mg
Pzbtzr
purchase disopyramide phosphate without prescription - <a href="https://anorpica.com/">buy disopyramide phosphate without a prescription</a> buy thorazine 100mg for sale
Nvflfm
oral spironolactone 25mg - <a href="https://aldantinep.com/dipyridamole/">persantine oral</a> revia 50 mg usa
Yjkytm
cytoxan us - <a href="https://cycloxalp.com/">buy cytoxan generic</a> order trimetazidine
Biecnf
cyclobenzaprine 15mg for sale - <a href="https://abflequine.com/enalapril/">buy vasotec pills</a> buy enalapril for sale
Lyttgs
order ondansetron 4mg online cheap - <a href="https://azofarininfo.com/procyclidine/">order procyclidine without prescription</a> ropinirole usa
Rgfkog
ascorbic acid 500 mg canada - <a href="https://mdacidinfo.com/">ascorbic acid order online</a> buy compro cheap
Svvrer
where can i purchase durex gel - <a href="https://xalaplinfo.com/">where can i order durex gel</a> order zovirax
Npzfyq
buy rogaine generic - <a href="https://mdacidinfo.com/dutasteride/">dutas without prescription</a> purchase propecia online cheap
Crbdzx
buy arava 10mg - <a href="https://infohealthybones.com/risedronate/">order risedronate online cheap</a> buy cartidin online
Lqifrp
calan 240mg canada - <a href="https://infoheartdisea.com/">verapamil 240mg drug</a> order tenoretic for sale
Lzelfe
order tenormin 50mg sale - <a href="https://heartmedinfox.com/sotalol/">purchase betapace generic</a> carvedilol for sale
Svrtuo
oral atorvastatin - <a href="https://infoxheartmed.com/enalapril/">order enalapril 10mg without prescription</a> nebivolol 5mg usa
Qklzxo
buy gasex - <a href="https://herbalinfomez.com/ashwagandha/">purchase ashwagandha without prescription</a> order diabecon sale
Qdcdgz
where can i buy lasuna - <a href="https://infoherbalmz.com/himcolin/">buy himcolin generic</a> cheap himcolin generic
Cqosik
noroxin cost - <a href="https://gmenshth.com/flutamide/">buy eulexin without prescription</a> buy cheap generic confido
Pdrgbj
finax without prescription - <a href="https://finmenura.com/kamagra/">buy sildenafil 100mg</a> order uroxatral 10mg
Bhigna
cheap generic speman - <a href="https://spmensht.com/finasteride/">cheap finasteride sale</a> buy fincar generic
Zweqvc
hytrin medication - <a href="https://hymenmax.com/tamsulosin/">purchase tamsulosin online cheap</a> priligy generic
Svniem
trileptal 600mg for sale - <a href="https://trileoxine.com/">order trileptal 600mg generic</a> buy levoxyl tablets
Ddvvrg
order cyclosporine generic - <a href="https://asimusxate.com/">oral cyclosporine</a> colchicine online order
Xjeymy
buy lactulose bottles for sale - <a href="https://duphalinfo.com/betahistine/">buy betahistine generic</a> buy betahistine 16 mg pill
Blncvr
calcort for sale online - <a href="https://lazacort.com/">order deflazacort</a> order brimonidine online cheap
Ziavrw
cost besifloxacin - <a href="https://besifxcist.com/carbocysteine/">buy carbocisteine pills</a> sildamax tablet
Caircl
gabapentin 600mg cost - <a href="https://aneutrin.com/sulfasalazine/">buy azulfidine pills for sale</a> buy sulfasalazine 500 mg sale
Lrfzaz
probenecid 500mg sale - <a href="https://bendoltol.com/">purchase probenecid generic</a> buy carbamazepine no prescription
Ayaqqq
buy celebrex 200mg for sale - <a href="https://celespas.com/">celecoxib 200mg for sale</a> order indomethacin 75mg generic
Fvosrv
buy mebeverine sale - <a href="https://coloxia.com/">order mebeverine sale</a> buy cilostazol online cheap
Ygnzxr
order voltaren 100mg pill - <a href="https://dicloltarin.com/">order diclofenac generic</a> aspirin 75mg canada
Czqmab
purchase rumalaya - <a href="https://rumaxtol.com/">rumalaya canada</a> endep 50mg price
Mvowxn
buy mestinon 60mg online - <a href="https://mestonsx.com/azathioprine/">imuran sale</a> order azathioprine 25mg pill
Omvgtw
diclofenac pill - <a href="https://vovetosa.com/animodipine/">nimotop order online</a> cheap nimotop generic
Ghaegr
cost meloxicam 7.5mg - <a href="https://meloxiptan.com/asrizatriptan/">buy rizatriptan 10mg online cheap</a> buy generic ketorolac
Ezwxdj
cyproheptadine 4 mg for sale - <a href="https://periheptadn.com/aszanaflex/">buy zanaflex pills for sale</a> purchase tizanidine for sale
Asktvg
order artane pills - <a href="https://voltapll.com.com/">artane online</a> order emulgel cheap
Bnpwmq
purchase cefdinir sale - <a href="https://omnixcin.com/aminocycline/"></a> buy cleocin no prescription
Ivcexe
order generic isotretinoin 40mg - <a href="https://aisotane.com/asavlosulfon/">oral avlosulfon 100mg</a> buy deltasone 40mg online cheap
Wxoztk
buy generic deltasone 10mg - <a href="https://apreplson.com/">prednisone 20mg for sale</a> zovirax creams
Fbqnyw
oral acticin - <a href="https://actizacs.com/tretinoin/">retin ca</a> order retin cream sale
Mojbwl
betnovate 20gm without prescription - <a href="https://betnoson.com/awdifferin/">adapalene brand</a> benoquin generic
Fjniir
order metronidazole 400mg generic - <a href="https://ametronles.com/">order generic metronidazole 200mg</a> buy generic cenforce over the counter
Lrydpk
amoxiclav for sale - <a href="https://alevonted.com/">order synthroid 150mcg online</a> buy generic synthroid 150mcg
Aekspc
buy clindamycin medication - <a href="https://indometnp.com/">indomethacin oral</a> purchase indocin sale
Jjggal
cozaar pill - <a href="https://cozartan.com/">cozaar for sale online</a> cephalexin 500mg brand
Sinlao
order generic eurax - <a href="https://aeuracream.com/abactroban/">mupirocin online order</a> buy aczone online cheap
Exgfdf
bupropion order - <a href="https://bupropsl.com/shuddhaguggulu/">where can i buy shuddha guggulu</a> buy shuddha guggulu paypal
Bczpqq
order modafinil 100mg online - <a href="https://sleepagil.com/melatonin/">order melatonin 3 mg pills</a> melatonin 3mg pill
Dbafox
order progesterone online - <a href="https://apromid.com/gynelotrimin/">buy ponstel vaginal cream</a> buy generic clomiphene online
Bzqmtu
capecitabine online - <a href="https://xelocap.com/naproxen/">naproxen 250mg oral</a> danocrine 100 mg without prescription
Eqtqhf
generic norethindrone 5mg - <a href="https://norethgep.com/">aygestin 5 mg price</a> where can i buy yasmin
Pemlvj
buy fosamax - <a href="https://pilaxmax.com/">fosamax 35mg ca</a> provera 5mg over the counter
Cegkep
dostinex brand - <a href="https://adostilin.com/premarin/">buy premarin 0.625mg for sale</a> alesse tablet
Vzbubu
order generic estrace 2mg - <a href="https://festrolp.com/">buy estradiol 2mg generic</a> buy anastrozole 1mg generic
Uxjmju
シルデナフィル 薬局で買える - <a href="https://jpedpharm.com/">バイアグラ通販</a> シアリス 海外通販
Oxixmj
プレドニンは薬局で買える? - <a href="https://jpaonlinep.com/jamoxicillin/">アモキシルは薬局で買える?</a> ジスロマック通販 安全
Fxxxku
プレドニン 海外通販 - <a href="https://jpanfarap.com/">プレドニン 薬局で買える</a> アキュテイン錠 5 mg 強さ
Ypakde
eriacta agony - <a href="https://eriagra.com/dapcalisb/">apcalis shine</a> forzest yawn