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