安装配置
安装 Python3
在 CentOS7 上安装
安装依赖
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel
编译python3
mkdir /home/py3 \
&& cd /home/py3 \
&& wget http://npm.taobao.org/mirrors/python/3.9.10/Python-3.9.10.tar.xz \
&& tar -xvf Python-3.9.10.tar.xz \
&& cd Python-3.9.10 \
&& ./configure prefix=/usr/local/python3 \
&& make -j && make install \
&& cd ../.. \
&& rm -rf py3\
&& ln -s /usr/local/python3/bin/python3.9 /usr/bin/python3 \
&& ln -s /usr/local/python3/bin/pip3.1 /usr/bin/pip3
设置 pip 国内源
pip config set global.index-url https://pypi.doubanio.com/simple
其他国内源
机构 | 地址 |
---|---|
清华大学 | https://pypi.tuna.tsinghua.edu.cn/simple |
豆瓣 | https://pypi.doubanio.com/simple |
华为云 | https://repo.huaweicloud.com/repository/pypi/simple |