安装

纯净的环境也安装不上d2l,python3.9能装上,运行就报错。

各位别像我一样耍小聪明用 python 3.10, 当前 d2l包和相关依赖只支持Python 3.9

1 Like

Python 的 版本装错了, 只能装 python 3.9,然后 pandas 的版本得退回到 1.2.4

参照文档,M2机器,在python3.9下,
pip install torch==1.12.0
pip install torchvision==0.13.0
pip install d2l==0.17.6

执行导入d2l包之后报错

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 6
      4 import torch
      5 from torch import nn
----> 6 from d2l import torch as d2l

File ~/anaconda3/envs/d2l4/lib/python3.9/site-packages/d2l/torch.py:32
     30 import zipfile
     31 from collections import defaultdict
---> 32 import pandas as pd
     33 import requests
     34 from IPython import display

File ~/anaconda3/envs/d2l4/lib/python3.9/site-packages/pandas/__init__.py:29
     22 from pandas.compat.numpy import (
     23     np_version_under1p17 as _np_version_under1p17,
     24     np_version_under1p18 as _np_version_under1p18,
     25     is_numpy_dev as _is_numpy_dev,
     26 )
     28 try:
---> 29     from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
     30 except ImportError as e:  # pragma: no cover
     31     # hack but overkill to use re
     32     module = str(e).replace("cannot import name ", "")

File ~/anaconda3/envs/d2l4/lib/python3.9/site-packages/pandas/_libs/__init__.py:13
      1 __all__ = [
      2     "NaT",
      3     "NaTType",
   (...)
      9     "Interval",
     10 ]
---> 13 from pandas._libs.interval import Interval
     14 from pandas._libs.tslibs import (
     15     NaT,
     16     NaTType,
   (...)
     21     iNaT,
     22 )

File pandas/_libs/interval.pyx:1, in init pandas._libs.interval()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

同样报错,兄弟解决了嘛。。。。。。。。。。

@Bill_Jin @WYWY 解决了!使用pip install d2l==1.0.0b0

还在吗,我是这样弄好的
pip install d2l ——> pip install d2l pandas==1.5.3

运行代码jupyter notebook后显示,‘jupyter’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。请问这里应该如何解决?