0.更改yum源
# 0.需要先使用已经准备好的prm包安装好wget(对应本文件的rpm安装包在当前目录的"安装包"目录下)
rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm
# 1.首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# 2.下载ailiyun的yum源配置文件到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 3.运行yum makecache生成缓存
yum makecache
# 4.这时候再更新系统就会看到以下mirrors.aliyun.com信息
yum -y update
1.centos7使用yum的方式安装python3
yum install epel-release -y
yum install https://centos7.iuscommunity.org/ius-release.rpm -y
yum install python36 u -y
2.Python换pip源
(1).常见的国内的源
豆瓣:http://pypi.douban.com/simple/
中科大:https://pypi.mirrors.ustc.edu.cn/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple
(2).一次性使用其他源
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install jupyter -i https://pypi.tuna.tsinghua.edu.cn/simple
这样就会从清华这边的镜像去安装jupyter库。
(3).永久修改的方式
1).Linux下更改
Linux下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url 为国内镜像地址,内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
2).Windows下更改
windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
3.jupyter安装后无中文字体库
# 1,安装jupyter
yum install jupyter
# 2,如果当前环境已经换源还是报错,就直接用一次性的换源方式去下载
yum insall jupyter -i https://pypi.tuna.tsinghua.edu.cn/simple
# 如果安装后无中文字体库
# 3,找到matplotlib库中存放字体的仓库(如果找不到matplotlib的默认目录,可以使用find -name去查找)
/usr/local/lib64/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf
# 4,将我们在windows本地的"C:\Windows\Fonts"找到的"simhei.ttf"中文字体库(或者直接在网上下载一个,然后上传到指定上述目录中)
# 5,然后删除matplotlib的缓存目录(也可以使用find -name去查是否存在指定目录)
rm -rf /root/.cache/matplotlib
# 6.重启jupyter服务端
jupyter notebook --allow-root
网友评论