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 ...
随机推荐
- 代码的二次重构(开篇:JDBC连接数据库)
Java中使用JDBC连接数据库时,若是使用初级的代码,代码复用率非常低,连接过程简单来说分为以下几个步骤: 加载驱动包 准备好URL链接获取数据库连接(driver和url根据不同的数据库的不同而不 ...
- 线性回归,多项式回归(P2)
回归问题 回归问题包含有线性回归和多项式回归 简单来说,线性回归就是用多元一次方程拟合数据,多项式回归是用多元多次来拟合方程 在几何意义上看,线性回归拟合出的是直线,平面.多项式拟合出来的是曲线,曲面 ...
- PreTranslateMessage(MSG* pMsg)专题
.. BOOL CQuickMosaicDlg::PreTranslateMessage(MSG* pMsg) { if (pMsg->message==WM_KEYDOWN) //键盘按下 { ...
- 一个封存Id与状态对应键值的神器,BigInteger的setBit和testBit用法实例
1,首先描述一下应用场景 比如,我们要对菜单做权限,控制不同角色菜单显示与不显示,角色为经理时,我们需要菜单id为 4,7,13,24的菜单显示,别的菜单不显示. 就是说,这时候我们要把4,7,13, ...
- Qt_技巧_将Qt动态链接生成的exe与dll打包方法
刚开始接触Qt,发现mac平台直接release编译一下就能够直接生成.app文件,并且可以直接运行..app位于工程文件内. 同样发方法在Windows直接运行exe却出现缺失dll情况. 讲过网上 ...
- (求凹包) Bicycle Race (CF 659D) 简单题
http://codeforces.com/contest/659/problem/D Maria participates in a bicycle race. The speedway t ...
- shell 命令 rz sz
尝试了几个版本,下面的是可用的 https://segmentfault.com/a/1190000012166969
- iOS处理视图上同时添加单击与双击手势的冲突问题
_bgView.userInteractionEnabled = YES; //在cell上添加 bgView,给bgView添加两个手势检测方法 UITapGestureRecognizer *do ...
- Python自动化开发 - 装饰器
本节内容 一.装饰器导引 1.函数对象特性 2.扩展业务功能需求 3.各种解决方案 二.装饰器解析 1.装饰器基本概念 2.无参装饰器解析 一.装饰器导引 1.函数对象特性 #### 第一波 #### ...
- SQL Server 2008 表分区的含义
https://www.cnblogs.com/knowledgesea/p/3696912.html 继续看这个文档 http://www.360doc.com/content/16/0104/11 ...