当我尝试使用其网站示例中的新模块requests_html时,我发现控制台在标题中显示信息。
- 我已经成功安装requests_html使用
pip install requests_html
- 我已将 python 更新为 python3.7(64 位)
控制台消息:
Traceback (most recent call last):
File "C:/Users/owlish/PycharmProjects/python34/requests.py", line 2, in <module>
from requests_html import HTMLSession
File "C:\Users\owlish\AppData\Local\Programs\Python\Python37\lib\site-packages\requests_html.py", line 10, in <module>
import requests
File "C:\Users\owlish\PycharmProjects\python34\requests.py", line 2, in <module>
from requests_html import HTMLSession
ImportError: cannot import name 'HTMLSession' from 'requests_html' (C:\Users\owlish\AppData\Local\Programs\Python\Python37\lib\site-packages\requests_html.py)
代码:
from requests_html import HTMLSession
session = HTMLSession()
r = session.get('https://python.org/')
我希望它可以正常工作,例如https://html.python-requests.org/示例。