凛冬将至

从简单的例子开始

0%

win10配置TensorFlow.md

尝试在win10的台式机上,配置TensorFlow。

看一下当前在哪个环境下

1
2
# Anaconda Prompt
conda info --env

换源,改成清华的(试了一下,虽然有vpn,但还是下不了50M的tensorflow-base-2.3.0)

1
2
3
4
# Anaconda Prompt
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

直接装tensorflow

1
2
# Anaconda Prompt
conda install tensorflow

试一下

1
2
3
4
5
# Anaconda Prompt
python

# python
import tensorflow

报错了

1
AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'

安装

1
pip install h5py==2.9

报错了

1
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

参考大佬博客,直接卸载了pip版的h5py即可

1
2
3
4
5
6
7
8
# Anaconda Prompt
pip uninstall h5py

# Anaconda Prompt
python

# python
import tensorflow

tip:尽量使用conda安装库