欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python的環(huán)境conda簡(jiǎn)介

 更新時(shí)間:2022年09月09日 14:47:12   作者:bugs-in-life  
conda是一個(gè)包,依賴(lài)和環(huán)境管理工具,適用于多種語(yǔ)言,如: Python, R, Scala, Java, Javascript, C/ C++, FORTRAN,這篇文章主要介紹了python的環(huán)境conda簡(jiǎn)介,需要的朋友可以參考下

Conda Guide

Conda簡(jiǎn)介

conda是一個(gè)包,依賴(lài)和環(huán)境管理工具,適用于多種語(yǔ)言,如: Python, R, Scala, Java, Javascript, C/ C++, FORTRAN。

應(yīng)用場(chǎng)景:比如在A(yíng)服務(wù)器開(kāi)發(fā)了一個(gè)應(yīng)用,安裝了N個(gè)包。現(xiàn)在要遷移到B服務(wù)器,又要重新安裝一遍,還不知道A服務(wù)器上哪些包是必須的。conda就是解決這種問(wèn)題,把該應(yīng)用需要的包都安裝到應(yīng)用所在的環(huán)境中,遷移的時(shí)候,只要把環(huán)境導(dǎo)出,再導(dǎo)入到B環(huán)境即可。

Conda的安裝

安裝過(guò)程

windows的安裝就不演示了,直接在網(wǎng)上搜miniconda安裝包,然后一路點(diǎn)下一步即可安裝完成。

下邊講解linux下的安裝

創(chuàng)建condarc.mirror文件

channels:
  - conda-forge
  - bioconda
  - 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
curl -L -o /tmp/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.11.0-Linux-x86_64.sh
/bin/bash /tmp/miniconda.sh -b -p /opt/conda
rm /tmp/miniconda.sh
conda clean -tipsy
find /opt/conda -follow -type f -name '*.a' -delete
find /opt/conda -follow -type f -name '*.pyc' -delete
conda clean -afy
cp ./condarc.mirror /root/.condarc

更新conda

conda update conda

鏡像服務(wù)器

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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --set show_channel_urls yes
# 執(zhí)行完上述命令后,會(huì)在Users目錄生成.condarc

環(huán)境管理

查看所有環(huán)境

conda env list

新建環(huán)境

conda create --name [name] python_or_others
ps: conda create --name FastAPI python=3.9.12

進(jìn)入環(huán)境

conda activate env_name

退出環(huán)境

conda deactivate

刪除環(huán)境

conda remove -n env_name --all

復(fù)制環(huán)境

conda create --clone ENVNAME --name NEWENV

package管理

列出package

conda list

列出指定環(huán)境中的所有軟件包

conda list -n myenv

安裝package

pip install xxxx 或者 conda install xxxx
ps:pip install tensorflow

如果不用-n指定環(huán)境名稱(chēng),則被安裝在當(dāng)前活躍環(huán)境,也可以通過(guò)-c指定通過(guò)某個(gè)channel安裝

conda install (-n python34) numpy

更新package

conda update (-n python34) numpy

卸載package

conda remove/uninstall package_name

查找package信息

conda search (-n python34) numpy

更新目前環(huán)境所有package

conda update --all

導(dǎo)出當(dāng)前環(huán)境的package信息

conda env export > environment.yaml

清除緩存

刪除索引緩存、鎖定文件、未使用的緩存包和tarball(壓縮包).

conda clean -a

環(huán)境的復(fù)制

注意:yaml的方式,很消耗資源,系統(tǒng)配置至少要2核4G以上,且yaml的package不能過(guò)多,否則會(huì)被killed

1、導(dǎo)出環(huán)境

conda env export > environment.yaml

文件內(nèi)容示例

name: kyle
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  - https://repo.anaconda.com/pkgs/main
  - 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/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - defaults
dependencies:
  - _pytorch_select=0.2=gpu_0
  - pip:
    - opencv-python==4.1.2.30

2、導(dǎo)入環(huán)境

conda env create -f environment.yaml

3、Clone環(huán)境

conda env update -n my_env --file ENV.yaml

到此這篇關(guān)于python的環(huán)境conda簡(jiǎn)介的文章就介紹到這了,更多相關(guān)python環(huán)境conda內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Python3導(dǎo)入自定義模塊的三種方法詳解

    Python3導(dǎo)入自定義模塊的三種方法詳解

    這篇文章主要給大家介紹了關(guān)于Python3導(dǎo)入自定義模塊的三種方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。
    2018-04-04
  • Python出現(xiàn)segfault錯(cuò)誤解決方法

    Python出現(xiàn)segfault錯(cuò)誤解決方法

    這篇文章主要介紹了Python出現(xiàn)segfault錯(cuò)誤解決方法,分析了系統(tǒng)日志提示segfault錯(cuò)誤的原因與對(duì)應(yīng)的解決方法,需要的朋友可以參考下
    2016-04-04
  • 使用Python matplotlib作圖時(shí),設(shè)置橫縱坐標(biāo)軸數(shù)值以百分比(%)顯示

    使用Python matplotlib作圖時(shí),設(shè)置橫縱坐標(biāo)軸數(shù)值以百分比(%)顯示

    這篇文章主要介紹了使用Python matplotlib作圖時(shí),設(shè)置橫縱坐標(biāo)軸數(shù)值以百分比(%)顯示,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-05-05
  • 用Matlab讀取CSV文件出現(xiàn)不匹配問(wèn)題及解決

    用Matlab讀取CSV文件出現(xiàn)不匹配問(wèn)題及解決

    這篇文章主要介紹了用Matlab讀取CSV文件出現(xiàn)不匹配問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-06-06
  • Pytorch使用MNIST數(shù)據(jù)集實(shí)現(xiàn)CGAN和生成指定的數(shù)字方式

    Pytorch使用MNIST數(shù)據(jù)集實(shí)現(xiàn)CGAN和生成指定的數(shù)字方式

    今天小編就為大家分享一篇Pytorch使用MNIST數(shù)據(jù)集實(shí)現(xiàn)CGAN和生成指定的數(shù)字方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-01-01
  • Django靜態(tài)文件加載失敗解決方案

    Django靜態(tài)文件加載失敗解決方案

    這篇文章主要介紹了Django靜態(tài)文件加載失敗解決方案,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-08-08
  • Keras中Conv1D的使用及說(shuō)明

    Keras中Conv1D的使用及說(shuō)明

    這篇文章主要介紹了Keras中Conv1D的使用及說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-12-12
  • Python實(shí)現(xiàn)socket非阻塞通訊功能示例

    Python實(shí)現(xiàn)socket非阻塞通訊功能示例

    這篇文章主要介紹了Python實(shí)現(xiàn)socket非阻塞通訊功能,結(jié)合實(shí)例形式分析了Python使用socket模塊進(jìn)行非阻塞通訊的原理、多線(xiàn)程及客戶(hù)端、服務(wù)器端相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2019-11-11
  • python?包之?threading?多線(xiàn)程

    python?包之?threading?多線(xiàn)程

    這篇文章主要介紹了python?包之?threading?多線(xiàn)程,文章通過(guò)實(shí)例化threading.Thread類(lèi)創(chuàng)建線(xiàn)程,下文相關(guān)資料介紹,需要的朋友可以參考一下
    2022-04-04
  • Python實(shí)現(xiàn)標(biāo)記數(shù)組的連通域

    Python實(shí)現(xiàn)標(biāo)記數(shù)組的連通域

    這篇文章主要為大家詳細(xì)介紹了如何通過(guò)Python實(shí)現(xiàn)標(biāo)記數(shù)組的連通域,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)Python有一定的幫助,需要的可以參考一下
    2023-04-04

最新評(píng)論