Since you need to use Beautifulsoup, then go to download: download address
Then remove it into the D: / Python directory, open the CMD window, enter the decompression directory, enter d: /python/beautifulsoup4-4.5.3/Beautifulsoup4-4.5.3
python setup.py build
python setup.py install
Install, the first command is not entered in the first command, and the result is not successful. Later, try to add Python, install success.
Enter Python, then enter
from bs4 import BeautifulSoup
The result is reported:
Traceback (most recent call last): File “”, line 1, in File “D:\python\beautifulsoup4-4.5.3\beautifulsoup4-4.5.3\bs4\_\_init\_\_.py”, line 53 ‘You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.’<>’You need to convert the code, either by installing it (python setup.py install) or by running 2to3 (2to3 -w bs4).’ SyntaxError: invalid syntax
Through the error message, it is found that the version does not correspond, so it exits Python, entered in CMD.
2TO3 -W BS4
Try imported again, success!
Python3 no longer has URLLIB2, replaced by Urllib.Request, so it can be replaced by using urllib2 in python2.
from beautifulsoup import beautifulsoup
is always wrong, replacing with from bs4 import beautyfulsoup