python安装requests模块报错

##安装模块
[root@Zabbix alertscripts]#yum install python-pip
[root@Zabbix alertscripts]# pip install requests

###查看所有安装模块
[root@Zabbix alertscripts]# pip list
You are using pip version 7.1.0, however version 20.1.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
backports.ssl-match-hostname (3.4.0.2)
certifi (2020.6.20)
chardet (3.0.4)
distribute (0.6.10)
idna (2.10)
iniparse (0.3.1)
netsnmp-python (1.0a1)
ordereddict (1.2)
pip (7.1.0)
pycurl (7.19.0)
pygpgme (0.1)
pyxdg (0.18)
requests (2.6.0)
setuptools (0.6rc11)
six (1.9.0)
urlgrabber (3.9.1)
urllib3 (1.10.2)
yum-metadata-parser (1.1.2)

###检查模块是否安装成功
[root@Zabbix alertscripts]# python
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

>>>
>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/requests/__init__.py", line 90, in <module>
    "version!".format(urllib3.__version__, chardet.__version__),
ValueError: zero length field name in format
>>>

##卸载模块
[root@Zabbix alertscripts]# pip uninstall requests

##使用yum安装
[root@Zabbix alertscripts]# yum install python-requests

##测试是否安装成功
[root@Zabbix alertscripts]# python
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

>>>
>>> import requests
>>>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值