安装

https://zh-v2.d2l.ai/chapter_installation/index.html

安装tensorflow 报错,请问要怎么处理呀?
:guitar:$ pip install tensorflow tensorflow-probability

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple

ERROR: Could not find a version that satisfies the requirement tensorflow

ERROR: No matching distribution found for tensorflow

:guitar:$

Hi @jidom

Tensorflow 需要 Python 3.5 to 3.8,并且只支持 64-bit 版本。可以用以下命令再jupyter内检查:

python version:

!python --version

32-bit or 64-bit 版本:

import struct
print(struct.calcsize("P")*8)

hi@goldpiggy 我可能是下载了最新版本的miniconda(Miniconda3-py39_4.9.2-MacOSX-x86_64.sh),python是3.9版本的,我将minicoda3目录删除,重新安装了Miniconda3-latest-MacOSX-x86_64.sh,结果又报错了:
:guitar:$ conda activate d2l
Could not find conda environment: d2l
You can list all discoverable environments with conda info --envs.

:guitar:$ ~/miniconda3/bin/conda init
no change /Users/lingxin/miniconda3/condabin/conda
no change /Users/lingxin/miniconda3/bin/conda
no change /Users/lingxin/miniconda3/bin/conda-env
no change /Users/lingxin/miniconda3/bin/activate
no change /Users/lingxin/miniconda3/bin/deactivate
no change /Users/lingxin/miniconda3/etc/profile.d/conda.sh
no change /Users/lingxin/miniconda3/etc/fish/conf.d/conda.fish
no change /Users/lingxin/miniconda3/shell/condabin/Conda.psm1
no change /Users/lingxin/miniconda3/shell/condabin/conda-hook.ps1
no change /Users/lingxin/miniconda3/lib/python3.8/site-packages/xontrib/conda.xsh
no change /Users/lingxin/miniconda3/etc/profile.d/conda.csh
no change /Users/lingxin/.bash_profile
No action taken.
:guitar:$ conda create --name d2l python=3.8 -y
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • python=3.8

Current channels:

To search for alternate channels that may provide the conda package you’re
looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

Hi @jidom,

试一下 conda install python=3.8.5. 详细见:https://chris35wills.github.io/conda_python_version/

下载官网上的jupyter记事本文件后,打开一些ipynb文件报错:Unreadable Notebook: /home/zhoupengchen/d2l/pytorch/index.ipynb NotJSONError("Notebook does not appear to be JSON: ''...")

例如在打开pytorch/index.ipynb的时候

Stackoverflow is always your friend to debug :slight_smile:

请问有解决方法吗?我也遇到同样的问题.而且index.ipynb文件是0kb,是不是这个文件有问题啊?

:sob::sob::sob:难受坏了 tensorflow_probability能够安装 但是导入时报错
情况一:
#python 3.8 cuda11.2
#pip install tensorflow==2.4.0 tensorflow-probability==0.12.2
#import tensorflow_probability as tfp 时报错AttributeError: module ‘tensorflow.python.util.tf_inspect’ has no attribute ‘Parameter’

#情况二:
#python 3.8 cuda11.2
#pip install tensorflow==2.5.0 tensorflow-probability==0.12.2
#import tensorflow_probability as tfp 时报错AttributeError: module ‘tensorflow.python.keras.api._v2.keras’ has no attribute

求一解决方案

请问文章中代码支持的tensorflow版本是多少

请问tensorflow 1.x可以运行本书的代码吗

去掉清华的源,直接用pip安装。或者尝试华为的源,资源更新的更快。