oldshensheep / v2ex_scrapy

scrapy for v2ex.com
https://www.v2ex.com/t/954480
MIT License
262 stars 55 forks source link

scrapy crawl v2ex 出错了 #1

Open xinmans opened 1 year ago

xinmans commented 1 year ago

包都pip install了 return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 848, in exec_module File "", line 219, in _call_with_frames_removed File "/home/xinmans/mydev/v2ex_scrapy/v2ex_scrapy/spiders/V2exSpider.py", line 7, in from v2ex_scrapy.DB import DB File "/home/xinmans/mydev/v2ex_scrapy/v2ex_scrapy/DB.py", line 7, in from v2ex_scrapy.items import ( File "/home/xinmans/mydev/v2ex_scrapy/v2ex_scrapy/items.py", line 13, in class Base(DeclarativeBase): File "/home/xinmans/mydev/v2ex_scrapy/v2ex_scrapy/items.py", line 15, in Base list[str]: JSON, TypeError: 'type' object is not subscriptabl

oldshensheep commented 1 year ago

需要python版本python>=3.10

xinmans commented 1 year ago

可以做个docker

Dockerfile

FROM python:3.10 WORKDIR /app

COPY requirements.txt /app/requirements.txt

RUN pip install -r requirements.txt

CMD cd /app && scrapy crawl v2ex

docker-compose.yml

version: "3.7" services: v2ex_scrpay: container_name: v2ex_scrpay build: . volumes:

运行sudo docker-compose up -d即可

oldshensheep commented 1 year ago

这个应用太简单了,加个Docker没必要

xinmans commented 1 year ago

这个应用太简单了,加个Docker没必要

是的 但是我基础环境是python3.8版本的,换版本影响其他应用了

oldshensheep commented 1 year ago

Python有很多第三方的环境管理工具,可以用不同的Python版本。