OSX Lion 上的 Scrapy 安装 [英] Scrapy installation on OSX Lion

查看:66
本文介绍了OSX Lion 上的 Scrapy 安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在尝试在 Lion 上安装 Scrapy,但不确定它是否正确安装.

So I'm trying to install Scrapy on Lion and am not sure if it's properly installed or not.

我按照这里的指南 http://doc.scrapy.org/en/latest/intro/install.html#intro-install

然后尝试做第一步,在这里创建一个教程项目,

Then tried to do the first step to create a tutorial project here,

http://doc.scrapy.org/en/latest/intro/教程.html

但是当我尝试跑步时,

scrapy startproject tutorial

它不起作用.我明白了……

It doesn't work. I get...

$ 蟒蛇scrapy/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: 无法打开文件 'scrapy': [Errno 2] 没有那个文件或目录

$ python scrapy /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'scrapy': [Errno 2] No such file or directory

知道为什么我会收到这样的错误吗?

Any idea why I get such an error?

推荐答案

结果很可能是路径问题.

Well turns out it's likely a path issue.

在我的 Mac 上,我使用了 /usr/bin 中的 easy_install.

On my Mac, I used easy_install from /usr/bin.

sudo /usr/bin/easy_install scrapy

生成的 scrapy 命令然后安装到 /usr/local/bin/scrapy 中.

The resulting scrapy command is then installed into /usr/local/bin/scrapy.

您的路径中可能没有那个目录,所以看看是否是这样:

You might not have that directory in your path, so see if that's true with:

echo $PATH

如果它不在那里,你可以像export PATH=/usr/local/bin:$PATH那样临时添加它,或者修改你的~/.bash_profile> 永久添加.

If it isn't in there, you can temporarily add it like export PATH=/usr/local/bin:$PATH, or modify your ~/.bash_profile to add it permanently.

或者,我通常不会在 Mac 上使用系统安装的 Python - 我安装自制软件并安装单独版本的 Python,然后安装具有该版本的 scrapy (scrapy> 然后安装到 /usr/local/share/python/scrapy).

Alternatively, I typically don't use the system installed Python in Mac - I install homebrew and install a separate version of Python, and install scrapy with that version (scrapy is then installed into /usr/local/share/python/scrapy).

这篇关于OSX Lion 上的 Scrapy 安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆