这里使用的是anaconda进行安装,因为anaconda集成了很多插件确实好用很多,省去了很多麻烦
一、安装anaconda
1)下载安装包
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
这里我是采用的最新版的
2)bash 安装包
https://blog.youkuaiyun.com/u010414589/article/details/51303502
3)加入环境变量
在/etc/profile最后一行加入
export PATH=/root/anaconda3/bin:$PATH
加入环境变量后才能使用
试一下是否安装成功
[root@node13 ~]# python
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information
出现python3才是对的,如果是2说明安装的anaconda的版本太低或者是环境变量为生效
二、配置pip源
安装好了anaconda里面自带有匹配,我们无需单独安装pip,但是国外的pip下载太慢,我们采用换镜像
在用户文件夹下新建.pip文件夹及pip.conf文件,写入
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
保存后即可
国内镜像汇总:
http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 华中理工大学
http://pypi.sdutlinux.org/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/ 中国科学技术大学
http://mirrors.aliyun.com/pypi/simple/ 阿里云
https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学
之后下载就会快的飞起
三、安装相对应的模块
比如xgboost模块
pip install xgboost
比如hyperopt模块
pip install hyperopt