推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
soulmine
V2EX  ›  Python

python 下有什么好用的多进程并发框架么

  •  
  •   soulmine · Oct 18, 2016 · 5494 views
    This topic created in 3640 days ago, the information mentioned may be changed or developed.
    写了个爬虫 但只是单进程的 想开多进程 具体要求就是可以自动协商不重复 不要开 100 个进程 回头输出了 100 份完全一样的结果
    12 replies  •  2016-10-18 12:12:07 +08:00
    Livid
        1
    Livid  
    MOD
    PRO
       Oct 18, 2016   ❤️ 1
    soulmine
        2
    soulmine  
    OP
       Oct 18, 2016
    @Livid 谢谢 我去看看 doc
    ericls
        3
    ericls  
       Oct 18, 2016 via iPhone
    asyncio
    clino
        4
    clino  
       Oct 18, 2016
    也可以用协程吧,如果非 cpu 密集型的话
    9hills
        5
    9hills  
       Oct 18, 2016
    multiprocess 就行
    soulmine
        6
    soulmine  
    OP
       Oct 18, 2016
    @9hills 这要在爬虫里面写啊 懒得去写 multiprocessing
    soulmine
        7
    soulmine  
    OP
       Oct 18, 2016
    @clino 只要能满足条件 其实无所谓的 爬虫肯定是受限于网络和 Io 的问题
    soulmine
        8
    soulmine  
    OP
       Oct 18, 2016
    @ericls 然而我用的 2.7....
    Nostalgia
        9
    Nostalgia  
       Oct 18, 2016
    推荐 concurrent.futures ,支持多进程 /多线程,且封装的接口一致;抽象的程度比 threading, multiprocessing 更高些。
    ericls
        10
    ericls  
       Oct 18, 2016 via iPhone
    asyncio 有 back port 吧

    另外楼上说的 promise 写起来也挺舒服的


    要注意 process pool executor 必须要 picklable
    shyling
        11
    shyling  
       Oct 18, 2016
    concurrent.futures , MultiThreadPool
    reyno
        12
    reyno  
       Oct 18, 2016 via iPhone
    直接上 gevent
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2197 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 16:09 · PVG 00:09 · LAX 09:09 · JFK 12:09
    ♥ Do have faith in what you're doing.