【发布时间】:2020-12-20 16:41:00
【问题描述】:
编辑: 试过评论区的方法,现在问题变成了:
Traceback (most recent call last):
File "crawlertest.py", line 2, in <module>
from bs4 import BeautifulSoup
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bs4/__init__.py", line 29, in <module>
from .builder import builder_registry
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bs4/builder/__init__.py", line 7, in <module>
from bs4.element import (
ImportError: cannot import name 'Stylesheet'
我尝试安装 beautifulsoup4
pip3 install beautifulsoup4 但它说
"无法获取 URL https://pypi.python.org/simple/beautifulsoup4/
确认 ssl 证书时出现问题:[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 警报协议版本 (_ssl.c:720) - 正在跳过
找不到满足要求 beautifulsoup4 的版本(来自版本:)
没有找到 beautifulsoup4 的匹配分布"
然后我尝试了pip3 install --upgrade pip,然后再次安装成功。我还安装了“请求”包。
但后来当我尝试在我的 Mac 上运行 requests 和 beautifulsoup4 时,它显示如下:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/urllib3/connectionpool.py", line 706, in urlopen
chunked=chunked,
类似的东西
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:720)
有什么办法可以解决吗?
【问题讨论】:
标签: python