Install Python Beautifulsoup_python under WINDOWS8

Source: Internet
Author: User

Operating Environment: Windows 8.1
python:2.7.6

At the time of installation, I used the pip to install the command as follows:

Copy Code code as follows:

Pip Install Beautifulsoup4

when running, the error is as follows:
Copy Code code as follows:

Exception:
Traceback (most recent call last):
File "J:\Program Files (x86) \python\python27\lib\site-packages\pip\basecomm
. py ", line 122, in main
Status = Self.run (options, args)
File "J:\Program Files (x86) \python\python27\lib\site-packages\pip\commands
stall.py ", line 278, in run
Requirement_set.prepare_files (finder, Force_root_egg_info=self.bundle, BU
E=self.bundle)
File "J:\Program Files (x86) \python\python27\lib\site-packages\pip\req.py",
Ne 1229, in prepare_files
Req_to_install.run_egg_info ()
File "J:\Program Files (x86) \python\python27\lib\site-packages\pip\req.py",
NE 292, in Run_egg_info
Logger.notify (' Running setup.py (path:%s) Egg_info for package%s '% (sel
Etup_py, Self.name))
File "J:\Program Files (x86) \python\python27\lib\site-packages\pip\req.py",
Ne 265, in setup_py
Import Setuptools
File "build\bdist.win-amd64\egg\setuptools\__init__.py", line one, in <modul
From setuptools.extension Import extension
File "build\bdist.win-amd64\egg\setuptools\extension.py", line 5, in <modul
File "build\bdist.win-amd64\egg\setuptools\dist.py", line, in <module>
File "build\bdist.win-amd64\egg\setuptools\compat.py", line, in <module>
File "J:\Program Files (x86) \python\python27\lib\simplehttpserver.py", line
, in <module>
Class Simplehttprequesthandler (Basehttpserver.basehttprequesthandler):
File "J:\Program Files (x86) \python\python27\lib\simplehttpserver.py", line
8, in Simplehttprequesthandler
Mimetypes.init () # try to read system Mime.types
File "J:\Program Files (x86) \python\python27\lib\mimetypes.py", Line 358, I
Nit
Db.read_windows_registry ()
File "J:\Program Files (x86) \python\python27\lib\mimetypes.py", line 258, I
Ead_windows_registry
For SubkeyName in Enum_types (HKCR):
File "J:\Program Files (x86) \python\python27\lib\mimetypes.py", line 249, I
Num_types
CType = Ctype.encode (default_encoding) # Omit in 3.x!
Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xb0 in position 1:ordin
Not in range (128)

Storing debug log for failure in C:\Users\Administrator\pip\pip.log

Workaround: Open the mimetypes.py file under C:\Python27\Lib and find about 256 lines of

Copy Code code as follows:

default_encoding = sys.getdefaultencoding ()

Change into:
Copy Code code as follows:

If sys.getdefaultencoding ()!= ' GBK ':
Reload (SYS)
Sys.setdefaultencoding (' GBK ')
default_encoding = sys.getdefaultencoding ()

After the installation is successful, verify that the installation was successful:

Copy Code code as follows:

C:\users\administrator>python
Python 2.7.6 (default, Nov 2013, 19:24:24) [MSC v.1500-bit (AMD64)] on 32
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>> from BS4 import BeautifulSoup
>>> exit ()

If the "from BS4 import BeautifulSoup" does not report an error, the installation is successful, otherwise, the following similar errors will be reported:
Copy Code code as follows:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Importerror:no module named BS4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.