Conda是一个开源的包、环境管理器,能够用于在同一个机器上安装不一样版本的软件包及其依赖,并可以在不一样的环境之间切换。html
Anaconda包括Conda、Python以及一大堆安装好的工具包,好比:numpy、pandas等。python
Anaconda 安装包能够到 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 下载。vim
Miniconda 是一个 Anaconda 的轻量级替代,默认只包含了 python 和 conda,可是能够经过 pip 和 conda 来安装所须要的包。segmentfault
Miniconda 安装包能够到 https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/ 下载。windows
[root@localhost ~]# wget https://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 ~]# ls Miniconda-3.16.0-Linux-x86_64.sh
[root@localhost ~]# /bin/bash Miniconda-3.16.0-Linux-x86_64.sh Do you approve the license terms? [yes|no] [no] >>> yes Miniconda will now be installed into this location: /root/miniconda - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/root/miniconda] >>> /miniconda Do you wish the installer to prepend the Miniconda install location to PATH in your /root/.bashrc ? [yes|no] [no] >>> no You may wish to edit your .bashrc or prepend the Miniconda install location: $ export PATH=/miniconda/bin:$PATH Thank you for installing Miniconda! [root@localhost ~]#
~/.bash_profile
, 参照第3步执行命令后的提示,把export PATH=/miniconda/bin:$PATH
添加到~/.bash_profile
文件末尾,最后执行source ~/.bash_profile
让其生效[root@localhost ~]# vim ~/.bash_profile 您在 /var/spool/mail/root 中有邮件 [root@localhost ~]# cat ~/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH export PATH=/miniconda/bin:$PATH [root@localhost ~]# source ~/.bash_profile
conda -V
查看conda版本[root@localhost ~]# conda -V conda 3.16.0
至此miniconda安装成功!bash
[root@localhost ~]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ [root@localhost ~]# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ [root@localhost ~]# conda config --set show_channel_urls yes
[root@localhost ~]# conda create -n py36 python=3.6 Fetching package metadata: ........ # 中途下载会须要一点点时间,请耐心等待 100% # To activate this environment, use: # $ source activate py36 # # To deactivate this environment, use: # $ source deactivate [root@localhost ~]#
[root@localhost ~]# source activate py36 (py36)[root@localhost ~]# conda list # packages in environment at /miniconda/envs/py36: # 省略... python 3.6.2 0 defaults readline 6.2 2 <unknown> setuptools 41.0.1 py36_0 # 省略...
requests
和pyspark
为例(py36)[root@localhost ~]# pip install requests Successfully installed chardet-3.0.4 idna-2.8 requests-2.22.0 urllib3-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 ~]# pip install pyspark Looking in indexes: http://pypi.douban.com/simple Collecting pyspark Downloading http://pypi.doubanio.com/.../pyspark-2.4.3.tar.gz (215.6MB) |████████████████████████████████| 215.6MB 2.0MB/s # 若是发现下载速度慢,能够Ctrl+C取消重试,这里我第二次才达到2.0MB/s Successfully installed pyspark-2.4.3 (py36)[root@localhost ~]# pip list # 省略... pyspark 2.4.3 requests 2.22.0 # 省略...
小结:那么这个就是个人安装过程了,可是给到你们一个建议。初学者不要使用这个集成环境,学习过程当中,咱们仍是一步步来体验学习的每个过程比较好。
你学废了吗?app