当前位置: 首页 > 后端技术 > Python

miniconda集成环境的安装与使用

时间:2023-03-26 00:37:57 Python

1.什么是康达?之间切换。Anaconda包括Conda、Python,以及大量安装好的工具包,如:numpy、pandas等。Anaconda安装包可以从https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/下载。Miniconda是Anaconda的轻量级替代品。它默认只包括python和conda,但你可以通过pip和conda安装需要的包。Miniconda安装包可以从https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/下载。2.在cones上安装Miniconda,在linxu中通过这个链接下载脚本[root@localhost~]#wgethttps://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda-3.16.0-Linux-x86_64.sh保存了"Miniconda-3.16.0-Linux-x86_64.sh"[24166764/24166764])[root@localhost~]#lsMiniconda-3.16.0-Linux-x86_64.sh执行脚本安装,在安装过程中,你会被要求做出几个选择[root@localhost~]#/bin/bashMiniconda-3.16.0-Linux-x86_64.sh你同意许可条款吗?[yes|no][no]>>>yesMiniconda现在将安装到这个位置:/root/miniconda-按ENTER确认位置-按CTRL-C中止安装-或者在下面指定一个不同的位置[/root/miniconda]>>>/miniconda您是否希望安装程序将Miniconda安装位置添加到/root/.bashrc中的PATH?[yes|no][no]>>>no您可能希望编辑您的.bashrc或在Miniconda安装位置之前添加:$exportPATH=/miniconda/bin:$PATH感谢您安装Miniconda![root@localhost~]#编辑~/.bash_profile,参考步骤3执行命令提示后在~/.bash_profile文件末尾添加exportPATH=/miniconda/bin:$PATH,最后执行source~/.bash_profile使其生效[root@localhost~]#vim~/.bash_profile你在/varMailin/spool/mail/root[root@localhost~]#cat~/.bash_profile#.bash_profile#获取别名和函数if[-f~/.bashrc];然后。~/.bashrcfi#用户特定环境和启动程序PATH=$PATH:$HOME/binexportPATHexportPATH=/miniconda/bin:$PATH[root@localhost~]#source~/.bash_profiletestconda-Vviewcondaversion[root@localhost~]#conda-Vconda3.16.0至此miniconda安装成功!3.Windows安装minicondahttps://conda.io/miniconda.html进入官网下载Miniconda安装包然后一路Next安装;4.使用conda配置anaconda仓库镜像源[root@localhost~]#condaconfig--addchannelshttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/[root@localhost~]#condaconfig--addchannelshttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/[root@localhost~]#condaconfig--setshow_channel_urlsyes创建虚拟环境[root@localhost~]#condacreate-npy36python=3.6Fetchingpackagemetadata:.......#中间下载需要一点时间,请耐心等待100%#激活此环境使用:#$sourceactivatepy36##停用此环境使用:#$sourcedeactivate[root@localhost~]#进入虚拟环境,查看安装了哪些包[root@localhost~]#sourceactivatepy36(py36)[root@localhost~]#condalist#packagesinenvironmentat/miniconda/envs/py36:#省略...python3.6.20defaultsreadline6.22setuptools41.0.1py36_0#省略...尝试安装其他第三方包,这里以requests和pyspark为例(py36)[root@localhost~]#pipinstallrequestsSuccessfullyinstalledchardet-3.0.4idna-2.8requests-2.22.0urllib3-1.25.3#这个第三方包比较小,安装方便,但是如果遇到比较大的三方包比较尴尬,所以这里加一个国内的pypi镜像地址(py36)[root@localhost~]#mkdir-p~/.pip/(py36)[root@localhost~]#vim~/.pip/pip.conf(py36)[root@localhost~]#cat~/.pip/pip.conf#pip.conf内容如下[global]index-url=http://pypi.douban.com/simple[install]trusted-host=pypi.douban.com(py36)[root@localhost~]#pipinstallpyspark在索引中查找:http://pypi.douban.com/simpleCollectingpyspark下载http://pypi.doubanio.com/…/pyspark-2.4.3.tar.gz(215.6MB)|█████████████████████████████████|215.6MB2.0MB/s#如果发现下载速度慢,可以按Ctrl+C取消重试。这里我第二次才达到2.0MB/s。成功安装了pyspark-2.4.3(py36)[root@localhost~]#piplist#Omit...pyspark2.4.3requests2.22.0#Omit...总结:那么这是我的安装过程,但是我想给大家一个建议,初学者不要用这个集成环境。在学习的过程中,我们还是一步一步去体验学习的每一个过程。你没用吗?