centos下安装pip以及使用

在使用centos7的软件包管理程序yum安装python-pip的时候会报一下错误:

No package python-pip available.
Error: Nothing to do
说没有python-pip软件包可以安装。

这是因为像centos这类衍生出来的发行版,他们的源有时候内容更新的比较滞后,或者说有时候一些扩展的源根本就没有。
所以在使用yum来search  python-pip的时候,会说没有找到该软件包。因此为了能够安装这些包,需要先安装扩展源EPEL。
EPEL(http://fedoraproject.org/wiki/EPEL) 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。
首先安装epel扩展源:

sudo yum -y install epel-release

然后安装python-pip

sudo yum -y install python-pip

安装完之后别忘了清除一下cache

sudo yum clean all

搞定,收工!

使用

往往安装完pip后,直接pip install xxx,会很慢或者超市,次数可以更新下源

编辑~/.pip/pip.conf

[global]
index-url=http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

然后在pip install就很快了。

突然有一天,执行pip install xxx时,提示:

[root@localhost ~]# pip install requests
Collecting requests
  The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host pypi.douban.com'.
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests

这是,可以在pip命令后添加“--trusted-host pypi.douban.com”

pip install --trusted-host pypi.douban.com

解决。

pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com docker-compose

 

转载于:https://my.oschina.net/u/1185936/blog/1487143

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值