为了安好anaconda的tensorflow真的是花了很长时间,现在终于安好了,来分享一下经验吧
首先一定要先安好anaconda,直接去清华镜像站就好。
https://mirrors.tuna.tsinghua.edu.cn/
安装最近版本就好(2019年的那几个都可以),现在tensorflow已经可以兼容python3.7。
检验自己anaconda是否安装成功,按下Win+R,打开cmd,输入
conda --version
如果出现
conda 4.5.4
类似的,那么恭喜你, anaconda安装成功!!!
接下来就是安装tensorflow.
相信官网
https://tensorflow.google.cn/install
可以直接在官网找到下载方法,或者直接输入以下(以下遇到选择直接输y就好)
conda create -n tensorflow python=3.6
然后再输入
pip install --upgrade tensorflow==1.12.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
这里tensorflow有许多版本,我选择了1.12.0的。
可以输入
anaconda search -t conda tensorflow
选择自己想要的版本就好,记着把上面的1.12.0改掉就好。
然后就下载完成了,输入:
conda list
如果可以找到tensorflow说明安装成功。
但是接下来我调用tensorflow出现以下提示
C:\Users\dell\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\dell\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\dell\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\dell\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\dell\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\dell\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\dell\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
按照提示一项项的改正就好了,比如第一句
C:\Users\dell\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
先找到路径
C:\Users\dell\Anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py
找到
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
将其改成
_np_quint8 = np.dtype([("quint8", np.uint8, (1,))])
就好了,下面的以此类推就好啦!!!
大功告成