美文网首页
mac 安装scrapy踏坑

mac 安装scrapy踏坑

作者: todobugs | 来源:发表于2019-10-24 10:50 被阅读0次

    因对python的爬虫技术比较感兴趣,所以想捣鼓下。
    网上浏览了下,发现scrapy爬虫框架用的挺多的,所以自己也安装下,安装后执行scrapy时,提示command not found。

    环境说明:
    mac catalina 系统
    python环境为3.7版本
    pip3的版本:19.1.3

    操作步骤:
    1、pip3 install Scrapy (安装成功,无报错日志信息)
    2、执行 scrapy ,返回提示信息 command not found

    经网上搜寻资料发现,需要创建软连接:
    本机python3.7的安装路径为:/Library/Frameworks/Python.framework/Versions/3.7/bin/scrapy

    解决方案为:
    执行:ln -s /Library/Frameworks/Python.framework/Versions/3.7/bin/scrapy /usr/local/bin/scrapy

    上述命令执行后在命令行输入:scrapy,返回信息如下:
    Scrapy 1.7.4 - no active project

    Usage:
    scrapy <command> [options] [args]

    Available commands:
    bench Run quick benchmark test
    fetch Fetch a URL using the Scrapy downloader
    genspider Generate new spider using pre-defined templates
    runspider Run a self-contained spider (without creating a project)
    settings Get settings values
    shell Interactive scraping console
    startproject Create new project
    version Print Scrapy version
    view Open URL in browser, as seen by Scrapy

    [ more ] More commands available when run from project directory

    Use "scrapy <command> -h" to see more info about a command

    image.png

    至此解决问题。

    相关文章

      网友评论

          本文标题:mac 安装scrapy踏坑

          本文链接:https://www.haomeiwen.com/subject/mqjrvctx.html