【python3】python3 ImportError: No module named requests

背景

使用python3当蜘蛛爬虫抓取网页时,需要引入requests,

但是当机器环境中没有requests时,会报错如下:

本文就OSX/Linux下如何解决这个问题展开思路

解决

1 首先我们需要pip,关于pip因为我们用的是python3,所以一切命令是基于pip3的,如果你在机器上使用pip3安装request时,出现异常,则需要2的步骤

 

2

I ended up posting this same question on the python mailing list, and got the following answer:

 

Which solved my question perfectly. After adding the following for my own:

 

So that I could run pip directly, I was able to:

 

or:

 


引自:

how to install pip for python3 on mac os x

发表评论

电子邮件地址不会被公开。