简体   繁体   English

scrapy需要python 2.7,但我已经拥有了

[英]scrapy requires python 2.7 but i already have

first of all i'm working on osx 10.6.8 首先,我正在研究osx 10.6.8

i installed scrapy using the command: 我使用命令安装了scrapy:

sudo easy_install Scrapy

and everything seemed working fine. 一切似乎都很好。 but when i try to create a new project using 但是当我尝试使用创建一个新项目时

scrapy startproject tutorial

i only get 我才得到

Scrapy 0.22.2 requires Python 2.7

scrapy

i tried this solution, but i get the same problem. 我尝试了这个解决方案,但我遇到了同样的问题。 how could i fix this? 我怎么能解决这个问题?

EDIT: i think i have understood the problem: easy-install referrs to an older version of python (2.6) that it is in my system under /Library/Python/2.6 (probably it was pre-installed), so i installed scrapy for python 2.6! 编辑:我想我已经理解了这个问题: easy-install引用旧版本的python(2.6),它在我的系统下/Library/Python/2.6 (可能它是预安装的),所以我安装了scrapy for python 2.6! that's why i get the error. 这就是我得到错误的原因。 but now i don't know how to install scrapy for the right version of python! 但现在我不知道如何为正确版本的python安装scrapy!

Execute which python 执行which python

and

python --version

my guess is scrapy is not linking to python2.7 by default. 我的猜测是默认情况下scrapy没有链接到python2.7。

Please, open /Library/Frameworks/Python.framework/Versions/2.7/site-packages/scrapy/__init__.py and insert at line 14: 请打开/Library/Frameworks/Python.framework/Versions/2.7/site-packages/scrapy/__init__.py并在第14行插入:

13 if sys.version_info < (2, 7):
14    print(sys.version_info)
15    print("Scrapy %s requires Python 2.7" % __version__)
16    sys.exit(1)

then scrapy startproject tutorial and show us the output 然后scrapy startproject tutorial并向我们​​展示输出

i solved following [this][1] guide and executing again: 我解决了[this] [1]指南并再次执行:

sudo easy_install scrapy

now it works! 现在它的作品!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 scrapy需要Python 2.7,但已经是 - scrapy requires Python 2.7 but already it is Ansible 2.13 yum 模块 - 要求目标 python 的最低版本为 2.7 或 3.5。 但我已经有了 - Ansible 2.13 yum module - requires minimum version of target python of 2.7 or 3.5. But I already have that 我如何删除 python 2.7,因为我已经在 ubuntu 上安装了 3.6.5? - How can i remove python 2.7 as i already have 3.6.5 installed on ubuntu? 当我已经安装了 3.8 时,为什么我的 Mac 使用 python 2.7? - Why is my Mac using python 2.7 when I have 3.8 already installed? 当我已经安装了python 3.6时,如何在运行python(和pipenv)2.7的pycharm中设置虚拟环境? - How do I set up a virtual environment in pycharm which runs python (and pipenv) 2.7 when I already have python 3.6 installed? 如何在Linux上的Python 2.7中绑定已经存在的套接字? - How can I bind already existing socket in Python 2.7 on Linux? 通过Scrapy(python 2.7)下载动态Webcontent - downloading dynamic webcontent through Scrapy (python 2.7) 设置Scrapy框架以在Python 2.7上运行 - Set up Scrapy framework to run on Python 2.7 使用Scrapy和Python 2.7的递归抓取Craigslist - Recursive Scraping Craigslist with Scrapy and Python 2.7 Docker 使用scrapy 构建最小图像python 2.7 - Docker build minimal image python 2.7 with scrapy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM