Python:Windows8下安装BeautifulSoup
运行环境:Windows 8.1
Python:2.7.6
在安装的时候,我使用的pip来进行安装,命令如下:
pip install beautifulsoup4
运行的时候,报错如下:
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 11, 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 15, in <module>
File "build\bdist.win-amd64\egg\setuptools\compat.py", line 19, 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
解决方法:打开C:\Python27\Lib下的 mimetypes.py 文件,找到大概256行的
default_encoding = sys.getdefaultencoding()
改成:
if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
default_encoding = sys.getdefaultencoding()
安装成功后,验证是否安装成功:
C:\Users\Administrator>python
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on 32
Type "help", "copyright", "credits" or "license" for more information.
>>> from bs4 import BeautifulSoup
>>> exit()
如果“from bs4 import BeautifulSoup”没有报错的话,则说明安装成功,否则,将报类似错误如下:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named bs4
原文地址:曾是土木人
转载请注明出处:http://www.cnblogs.com/hongfei/p/3763184.html
Python:Windows8下安装BeautifulSoup的更多相关文章
- (原创)Windows8下安装配置WAMP
Windows8下安装配置WAMP 2013/12/28 最近这段时间一直在研究linuxshell编程,虽然还是初级水平,但比之前有了不小的进度,但是shell的命令很多,很难在短时间 ...
- Python-Windows下安装BeautifulSoup和requests第三方模块
http://blog.csdn.net/yannanxiu/article/details/50432498 首先给出官网地址: 1.Request官网 2.BeautifulSoup官网 我下载的 ...
- MacOS下安装BeautifulSoup库及使用
BeautifulSoup简介 BeautifulSoup库是一个强大的python第三方库,它可以解析html进行解析,并提取信息. 安装BeautifulSoup 打开终端,输入命令: pip3 ...
- python环境下安装virtualenv,virtualenvwrapper
在使用 Python 开发的过程中,工程一多,难免会碰到不同的工程依赖不同版本的库的问题: 亦或者是在开发过程中不想让物理环境里充斥各种各样的库,引发未来的依赖灾难. 此时,我们需要对于不同的工程使用 ...
- Mac下安装BeautifulSoup
1.输入命令su,输入root密码,进入root用户 2.执行命令安装pip: sudo easy_install pip 详细pip介绍:http://blog.csdn.net/olanlanxi ...
- Windows下Python 3.6 安装BeautifulSoup库
- - 下载安装 安装方法如下: 到 - PIP安装 如果上一种方法安装不成功,可以用第二种方法,记住,Python3.6下是pip3. 安装方法如下: pip3 install beautifuls ...
- Windows python3.3下安装BeautifulSoup
首先在官网下载:http://www.crummy.com/software/BeautifulSoup/#Download BeautifulSoup在版本4以上都开始支持python3了,所以就下 ...
- 如何在python3.5环境下安装BeautifulSoup?
首先是安装: 1.到http://www.crummy.com/software/BeautifulSoup/网站上上下载 2.下载完成之后需要解压缩,假设放到D:/python下. 3.运行cmd, ...
- python学习之——安装Beautifulsoup、requests、lxml
安装Beautiful soup: 1.下载安装包,解压到python的安装目录: 2.cmd 进入安装包解压后的存放位置: 3.使用命令:python setup.py build , pyt ...
随机推荐
- 用mathematica求六元一次方程组且方程个数比变量个数少一个
问题详见知乎:https://www.zhihu.com/question/68000713 我的问题:有5个方程,6个变量,其实我是想求出来de1=(系数)*dS1的形式,系数有Cij组成,Cij为 ...
- Mybatis-Plus 实战完整学习笔记(六)------select测试一
查询方法(3.0.3) 1.查询一个员工的数据 @Test public void selectMethod() throws SQLException { // 根据ID获取一个对象的数据 Empl ...
- SVN被锁定的几种解决方法
用SVN经常出现被锁定而无法提交的问题,选择解锁又提示没有文件被锁定,很是头疼.这里整理了一下SVN被锁定的几种解决方法: 1.出现这个问题后使用“清理”即"Clean up"功能 ...
- Event.target和Event.currentTarget的区别
<style> * { margin:0; padding:0; list-style:none; } #ul { width:400px; height:250px; margin:0 ...
- 开源javacsv读取csv文件
一.下载地址:https://sourceforge.net/projects/javacsv/ 读取示例: public static void main(String[] args) { // 1 ...
- Language Oriented Programming:下一代编程样式 Part I (翻译)
原文信息 原文地址 作者信息 Sergey Dmitriev JetBrains Sergey Dmitriev is the cofounder and CEO of JetBrains Inc., ...
- Libre Office超链接单元格
使用Numbers想实现MS Office中的超链接单元格功能,在网上找了半天,发现没有此功能.伤心.. MAC中安装Libre Office 打开表格类文档 选择需要超链接的单元格,选择“Inser ...
- Qt_简介
Qt简介: 1990 开发 1991 发布Qt 1.0. 公司:Trolltech (奇趣科技) 1997 Qt被用来开发Linux桌面KDE 2008 被Nokia收购 2012 被转让给Digia ...
- 实用shell命令100条
1,echo "aa" > test.txt 和 echo "bb" >> test.txt //>将原文件清空,并且内容写入到文件中, ...
- Java案例:随机点名器
案例介绍: 随机点名器,即在全班同学中随机的找出一名同学,打印这名同学的个人信息.需具备以下3个内容:1)存储所有同学姓名2)总览全班同学姓名3)随机点名其中一人,打印到控制台 案例需求分析: 全班同 ...