-1

edit: I tried the method in the comment section and now the problem becomes:

    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'

I tried to install beautifulsoup4 with pip3 install beautifulsoup4 but it said
"Could not fetch URL https://pypi.python.org/simple/beautifulsoup4/
There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:720) - skipping
Could not find a version that satisfies the requirement beautifulsoup4 (from versions: ) No matching distribution found for beautifulsoup4"
Then I tried pip3 install --upgrade pip and then installed again and succeeded.I also installed the package "requests".
But later when I tried to run requests and beautifulsoup4 on my Mac but it showed something like this:

    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,

and something like

ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:720)
      

Is there any way to fix it?

WinnieXi
  • 13
  • 1
  • 4

1 Answers1

0

I think you don't have the base certificates installed.

Go to:

Macintosh HD > Applications > Python3.x

And run Install Certificates.command

Also, refer the following links:

certificate verify failed: unable to get local issuer certificate

https://github.com/urllib3/urllib3/issues/1682

MRUNAL MUNOT
  • 395
  • 1
  • 5
  • 18