I have downloaded beautifulsoup4-4.5.3.tar.gz from https://www.crummy.com/software/BeautifulSoup/bs4/download/4.5/ and unzipped it to my python work directory(which is not my python install directory).
However, when I run
from bs4 import BeautifulSoup
in my IDLE the error massage popped out:
>>> from bs4 import BeautifulSoup
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
from bs4 import BeautifulSoup
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
I tried these methods but the error massage above keeps popping out
- open setup.py in my IDLE and run it(gives
=== RESTART: D:\python\beautifulsoup4-4.5.3\beautifulsoup4-4.5.3\setup.py ===
in IDLE windows, butfrom bs4 import BeautifulSoup
didn't work) - use cmd and go to D:\python\beautifulsoup4-4.5.3\beautifulsoup4-4.5.3, run
pip uninstall beautifulsoup4
then runpip install beautifulsoup4
;it shows that I have successfully installed beautifulsoup4-4.5.3 in cmd line, however, error massage still appearred in IDLE afterfrom bs4 import BeautifulSoup
- use cmd and go to
D:\python\beautifulsoup4-4.5.3\beautifulsoup4-4.5.3, run
pip3 uninstall beautifulsoup4
then runpip3 install beautifulsoup4
; useless as above - run
pip install bs4 --ignore-installed
,useless as above - run
setup.py install
,useless as above - run
2to3 -w bs4
in cmd line under D:\python\beautifulsoup4-4.5.3\beautifulsoup4-4.5.3, returns'2to3' is not recognized as an internal or external command,operable program or batch file.
what should I do?
beside,pip show bs4
gives this
`Metadata-Version: 1.1
Name: bs4
Version: 0.0.1
Summary: Screen-scraping library
Home-page: https://pypi.python.org/pypi/beautifulsoup4
Author: Leonard Richardson
Author-email: leonardr@segfault.org
License: MIT
Location: c:\users\myname\appdata\local\programs\python\python35-
32\lib\site-packages
Requires: beautifulsoup4
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip'
command.`
under my C:\Users\myname\AppData\Local\Programs\Python\Python35-32\Lib\site-packages directory, I can see three beautifulsoup related directories:beautifulsoup4-4.5.3.dist-info, bs4 and bs4-0.0.1-py3.5.egg-info, but from bs4 import BeautifulSoup
keep throwing out wrong message