3

我想执行以下命令...

scrapy startproject resultScrapper

但是,出现以下错误...

-bash: /Users/usrname/Library/Enthought/Canopy_64bit/User/bin/scrapy: /Users/usrname/Library/Enthought/Canopy_32bit/User/bin/python: bad interpreter: No such file or directory

哪个scrapy

/Users/usrname/Library/Enthought/Canopy_64bit/User/bin/scrapy

这是 $PATH

echo $PATH
/Users/usrname/Library/Enthought/Canopy_64bit/User/bin:/Users/usrname/Library/Enthought/Canopy_64bit/System/bin:/Users/usrname/Library/Enthought/Canopy_64bit/User/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin

我已经删除了 Canopy_32bit 版本……它仍然被引用吗?$PATH 也不包含指向它的链接。

4

1 回答 1

1

我怀疑解释器在scrapy脚本的 shebang 行中设置不正确。

如果输出

head -n1 /Users/usrname/Library/Enthought/Canopy_64bit/User/bin/scrapy

#! /Users/usrname/Library/Enthought/Canopy_32bit/User/bin/python

那么您应该将其更改为

#! /usr/bin/env python

(更便携,但它可能不会调用你想要的python)或

#! /Users/usrname/Library/Enthought/Canopy_64bit/User/bin/python

(不太便携,但强制使用 64 位 Enthought python;假设该路径对您的系统是正确的)

更有趣的是,64 位安装会链接到 32 位解释器。有许多可能的解释,但我担心的一个是存在一些不适用于 64 位的依赖项。对于纯 python(根据网站,Scrapy 是),这应该不是问题。

于 2013-05-14T09:33:51.287 回答