欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

python安装requests模块报错

程序员文章站 2022-06-21 23:33:05
##安装模块[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

相关标签: python pip centos