@GEEKO
2017-11-15T16:37:47.000000Z
字数 1189
阅读 371
Python
1、下载Python3 版本pip install python3
2、用命令删除usr/bin/目录下的默认python link文件
//usr/bin$ sudo rm -rf python
3、给系统默认python编译器建立新的连接
//usr/bin$ sudo ln -s /usr/bin/python3.6 /usr/bin/python
1、~/.pip/pip.conf
修改pip.conf配置,如果没有该该目录和该文件,则自己手动创建
2、配置pip.conf文件
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
timeout = 1500 # 超时时间设置(单位为s),一般可以设置的长一些
国内源(新版ubuntu要求使用https源,要注意。):
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣:http://pypi.douban.com/simple/
from fake_useragent import UserAgent
ua = UserAgent()
headers = {'User-Agent': ua.random}
pip install fake-useragent
在安装Scrapy框架的时候出现如下错误解决办法
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
解决办法:
1、下载对应版本的文件whl,我这里下载的是Twisted‑17.9.0‑cp36‑cp36m‑win_amd64.whl
cp后面代表的是Python的版本,后面64代表的是64位操作系统
https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
2、把下载好的whl文件放在D盘根目录,然后执行下安装命令
pip install D:\Twisted-17.9.0-cp36-win_amd64.whl