关于#python#的问题:cannot import name 'BytesType' from 'diskcache.core'

img

img


有老哥知道这是怎么回事么,代码是按照《pytorch深度学习实战》上敲的,但是这个问题目前无法解决。已经用pip安装了diskcache了,但依旧显示无法加载BytesType。

查看这个issue。
https://github.com/deep-learning-with-pytorch/dlwpt-code/issues/27

解决方案:
导入一下包
from cassandra.cqltypes import BytesType
from diskcache import FanoutCache, Disk,core
from diskcache.core import io
from io import BytesIO
from diskcache.core import MODE_BINARY

可能是:

  1. 路径问题
  2. 重名问题
  3. 交叉import问题