分类 Python 下的文章

configure: error: no acceptable C compiler found in $PATH 问题解决

1、下载python

wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz

2、解压、编译安装(依次执行以下5条命令)

tar -zxvf Python-2.7.15.tgz
cd Python-2.7.15
./configure --prefix=/usr/local/python-2.7.15
make
make install

3、如果系统自带了python版本,修改默认版本详见
https://blog.csdn.net/u011534057/article/details/51615193

4、安装后查看python版本号

python -V

安装遇到的问题

configure: error: no acceptable C compiler found in $PATH

安装gcc即可

yum install gcc

在使用python的时需使用pip安装各种模块,但是由于国外官方pypi经常被墙导致不可用或下载很慢,所以更换下自己的pip源,下载速度就会很快。

推荐清华大学的pip源,它是官网pypi的镜像,每隔5分钟同步一次,具体说明查看:
https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

pypi 镜像使用帮助
pypi 镜像每 5 分钟同步一次。

临时使用

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
注意,simple 不能少, 是 https 而不是 http
如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tushare

设为默认

升级 pip 到最新的版本 (>=10.0.0) 后进行配置:

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

更多其他镜像:

https://mirrors.tuna.tsinghua.edu.cn/

免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。