pip install beautifulsoup4.失败
在学习python爬虫时,用到bs4解析网页,开始遇到安装bs出错
Collecting beautifulsoup4
Exception:
Traceback (most recent call last):
File "g:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "g:\python27\lib\site-packages\pip\commands\install.py", line 324, in ru
requirement_set.prepare_files(finder)
File "g:\python27\lib\site-packages\pip\req\req_set.py", line 380, in prepare
files
ignore_dependencies=self.ignore_dependencies))
File "g:\python27\lib\site-packages\pip\req\req_set.py", line 620, in _prepar
_file
session=self.session, hashes=hashes)
File "g:\python27\lib\site-packages\pip\download.py", line 821, in unpack_url
hashes=hashes
File "g:\python27\lib\site-packages\pip\download.py", line 659, in unpack_htt
_url
hashes)
File "g:\python27\lib\site-packages\pip\download.py", line 880, in _download_
ttp_url
file_path = os.path.join(temp_dir, filename)
File "g:\python27\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 7: ordinal
not in range(128)
解决方法:
原因:pip安装python包会加载用户目录,用户目录恰好是中文的,ascii不能编码。解决办法是:
python目录 Python27\Lib\site-packages 建一个文件sitecustomize.py
内容写:
import sys
sys.setdefaultencoding('gb2312')
pip install beautifulsoup4.失败的更多相关文章
- 解决Pip install Pillow 失败问题
当我在使用Django一个上传图片功能的时候, Django 提示我安装 Pillow这个图片处理的库, 当我尝试安装的时候. 总是提示安装失败 报如下错误. v = self._sslobj.rea ...
- ubuntu下pip install mysql-python 失败的解决方案
ubuntu连接mysql 需要安装mysql-python 出现can not find mysql-config 文件错误 先安装 sudo apt-get install libmysqld-d ...
- pip install pyspider失败的解决办法
td{ width:10000px } 报错 下载pycurl库 地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl 选择对应的python版本 ...
- pip install dal 失败问题
这个问题是我在看一本<Django企业开发实战>运行其中一个项目时遇到的 作为一个自学的python 这种问题挺头疼的 这不是代码逻辑的问题 没法像Debug 一样去找问题 我们能依据的 ...
- pip install MySQL-python 失败
1. EnvironmentError: mysql_config not found原因:/usr/bin/mysql_config没有次文件,要安装libmysqlclient-dev, apt ...
- python安装第三方库aiohtpp,sanio失败,pip install multidict 失败问题
1.python的第三库安装地址:http://www.lfd.uci.edu/~gohlke/pythonlibs 2. 3.pip安装.whl文件指定该文件的位置
- pip install Yellowfin失败的问题
上面的方法简单有效 https://blog.csdn.net/quqiaoluo5620/article/details/80608474
- 使用pip安装BeautifulSoup4模块
1.测试是否安装了BeautifulSoup4模块 import bs4 print bs4 执行报错说明没有安装该模块 Traceback (most recent call last): File ...
- sudo pip install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple ipython
sudo pip install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple ipython
随机推荐
- VBoxManage
虚拟机名称 centos6.9-1 centos6.9-2 centos6.9-3 使用命令开机 虚拟机 VBoxManage startvm 'centos6.9-1' 正常启动 VBoxManag ...
- Java发送邮件 —— SpringBoot集成Java Mail
用途:此文仅供,自己今后的小程序通过邮件,批量通知用户. 简单记录了一些发送基本邮件的操作. 项目(SpringBoot版本为2.1.2.RELEASE): 核心依赖(其他相关依赖,在其使用的地方具体 ...
- React Native图片缓存解决方案
1. react-native-fetch-blob 将图片存在本地的一个东西 2. react-native-img-cache 自动缓存的一个东西 上面装好后 就可以使用啦 import {Cac ...
- day3——两数之和
// 小白一名,0算法基础,艰难尝试算法题中,若您发现本文中错误, 或有其他见解,往不吝赐教,感激不尽,拜谢. 领扣 第2题 今日算法 题干 //给定一个整数数组和一个目标值,找出数组中和为目标值的两 ...
- windows平台 python生成 pyd文件
Python的文件类型介绍: .py python的源代码文件 .pyc Python源代码import后,编译生成的字节码 .pyo Python源代码编译优化生成的字节 ...
- python基础知识点(unittest)
目录: unittest 单元测试框架 1.写用例: Testcase 2.执行:TestSuite 类 TestLoader 类 3.比对结果(期望值/实际值):断言函数 4.结果:TestText ...
- 基于python的Splash基本使用和负载均衡配置
0.引言 由于在软件工程综合实践专题课程中,老师要求在博客园发表博客我自己做过的小项目,本博客为课程第一篇博客 本项目来源于寒假学习python网络爬虫时所做的实战小项目,经过精心挑选,选择了页面动态 ...
- 点击回到顶部(jQuery)
写这个点击回到顶部.我采用的是最简单的jQuery,的点击事件 和animate特效. html部分 <div class="pulltop"> <img sr ...
- activiti-explore(activiti5.17) 替换数据库
http://blog.csdn.net/xiangwangye66/article/details/46943301
- 百度AI开放平台 情感倾向分析实例以及gbk编码解决
f=open('test.txt','a+',encoding='utf-8') for index,row in cxzg.iterrows(): text=str(row['text']) tex ...