Python3错误使用pyowm导入OWM会产生RequestsDependencyWarning:



我最近从python2.7.16升级到python3.7.3,当我运行天气脚本时,我收到RequestsDependencyWarning错误。我把它从pyowm导入OWM缩小到

>>> from pyowm import OWM
/home/pi/.local/lib/python3.7/site-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.2) or chardet (2.0.3) doesn't match a supported version!
RequestsDependencyWarning)
>>>

我尝试过以下几种:

~ $ pip uninstall docker-compose
WARNING: Skipping docker-compose as it is not installed.
~ $ pip install chardet
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: chardet in /usr/lib/python3/dist-packages (3.0.4)
~ $ pip install requests
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in ./.local/lib/python3.7/site-packages (2.25.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests) (1.26.2)
Requirement already satisfied: idna<3,>=2.5 in /usr/lib/python3/dist-packages (from requests) (2.6)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests) (2018.8.24)
Requirement already satisfied: chardet<5,>=3.0.2 in /usr/lib/python3/dist-packages (from requests) (3.0.4)
pip install urllib3
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: urllib3 in /usr/local/lib/python3.7/dist-packages (1.26.2)

当我尝试从请求导入得到时,我得到了相同的错误

>>> from requests import get
/home/pi/.local/lib/python3.7/site-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.2) or chardet (2.0.3) doesn't match a supported version!
RequestsDependencyWarning)
>>>

欢迎任何其他想法。

我升级了chardet:

pip install --upgrade chardet
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: chardet in /usr/lib/python3/dist-packages (3.0.4)
Collecting chardet
Downloading https://www.piwheels.org/simple/chardet/chardet-4.0.0-py2.py3-none-any.whl (178 kB)
|................................| 178 kB 409 kB/s
Installing collected packages: chardet
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
elastalert 0.2.4 requires PyYAML>=3.12, which is not installed.
elastalert 0.2.4 requires texttable>=0.8.8, which is not installed.
noaa-sdk 0.1.18 requires requests==2.22.0, but you have requests 2.25.1 which is incompatible.
aiohttp 3.6.2 requires chardet<4.0,>=2.0, but you have chardet 4.0.0 which is incompatible.
Successfully installed chardet-4.0.0

然后我注意到PyYAML和texttable不见了。安装完这两个项目后,我升级了chardet:

pip install --upgrade chardet
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: chardet in ./.local/lib/python3.7/site-packages (4.0.0)

看到chardet的要求得到了满足,我重试了我的脚本,它运行良好

相关内容

  • 没有找到相关文章

最新更新