当前位置: 移动技术网 > IT编程>脚本编程>Python > python安装requests模块报错

python安装requests模块报错

2020年07月30日  | 移动技术网IT编程  | 我要评论
##安装模块[root@Zabbix alertscripts]#yum install python-pip[root@Zabbix alertscripts]# pip install requests###查看所有安装模块[root@Zabbix alertscripts]# pip listYou are using pip version 7.1.0, however version 20.1.1 is available.You should consider upgrading v

##安装模块
[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
>>>

本文地址:https://blog.csdn.net/Cheney_My/article/details/107664917

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网