Windows10 在Anaconda 安装 TensorFlow2.0(2.0.0b1)

1.安装anaconda
目前anaconda官网的python版本是3.7的,可能不太支持tensorflow,你可以使用旧的python3.6版本的anaconda,如:Anaconda3-5.1.0-Windows-x86_64.exe。但我的py3.7可以兼容。

2.使用Anaconda Prompt命令行界面安装

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple #设置清华源
pip install pip -U # 升级 pip
pip install tensorflow==2.0.0b1 
pip install tensorflow-gpu==2.0.0b1

3可能会遇到的问题

<1>
Cannot uninstall ‘wrapt’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
解决办法:
忽略旧版本升级:sudo pip install wrapt --ignore-installed wrapt
或找到wrapt-1.10.11-py3.7.egg-info,一般就在usr/lib/python3.7或者其他安装pythonxxx dist-packages等路径里,可以直接在/目录下全局搜索。然后删掉即可。

<2>
import tensorflow #因numpy报错
ModuleNotFoundError: No module named ‘numpy.core._multiarray_umath’
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “

SystemError: returned a result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-07-15 11:40:39.634267: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr
**解决办法:**卸载numpy,然后重新安装。
pip uninstall numpy
pip install numpy

你可能感兴趣的:(TensorFlow)