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
>>>
本文地址:https://blog.csdn.net/Cheney_My/article/details/107664917
推荐阅读
-
Windows系统下安装Python的SSH模块教程
-
windows下安装python paramiko模块的代码
-
python中如何使用requests模块下载文件并获取进度提示?
-
python requests模块
-
Python使用lxml模块和Requests模块抓取HTML页面的教程
-
Python首次安装后运行报错(0xc000007b)的解决方法
-
win与linux系统中python requests 安装
-
Python 使用requests模块发送GET和POST请求的实现代码
-
Python Paramiko模块的安装与使用详解
-
python安装PIL模块时Unable to find vcvarsall.bat错误的解决方法