Python3 错误使用 pyowm import OWM 产生 RequestsDependencyWarning:
Python3 ERROR With pyowm import OWM produces RequestsDependencyWarning:
我最近从 python2.7.16 升级到 python3.7.3,当我 运行 我的天气脚本时,我得到一个 RequestsDependencyWarning 错误.我把它缩小到 from pyowm import 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
时遇到同样的错误
>>> 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 和文本表丢失了。安装这两个项目后,我升级了 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 要求得到满足,我重试了我的脚本,它工作正常
我最近从 python2.7.16 升级到 python3.7.3,当我 运行 我的天气脚本时,我得到一个 RequestsDependencyWarning 错误.我把它缩小到 from pyowm import 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
时遇到同样的错误>>> 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 和文本表丢失了。安装这两个项目后,我升级了 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 要求得到满足,我重试了我的脚本,它工作正常