Ubuntu16.04使用Anaconda安装tensorflow-CPU

1.安装Anaconda3

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-4.2.0-Linux-x86_64.sh
bash Anaconda3-4.2.0-Linux-x86_64.sh

接着就要激活环境,export PATH=/root/anaconda3/bin:$PATH,让环境变量生效

2.安装tensorflow

conda create -n tensorflow3.5 pip python=3.5
source activate tensorflow3.5
pip install --ignore-installed --upgrade https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.7.0-cp35-cp35m-linux_x86_64.whl
退出环境是
source deactivate
安装的时候遇到问题1:

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-g3ii_1q2/futures/

解决方法:
pip install --upgrade pip

重新运行上面的pip install --igo…
成功安装

安装的时候遇到问题2:

AttributeError: module ‘numpy’ has no attribute ‘equal’

解决方法:
pip install -U numpy
pip show numpy
安装出现问题3

FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecate

解决方法:

numpy版本过高,给numpy降级,问题解决

pip install numpy==1.16.0

参照https://blog.csdn.net/bigdream123/article/details/99467316

3.测试

自己会装好,然后测试一下

//输入python进入,然后输入一下代码
import tensorflow as tf
hello=tf.constant('hello')
sess=tf.Session()
print(sess.run(hello))
遇见问题:

I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

解决方案

1.掩耳盗铃式

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

参照https://blog.csdn.net/feng98ren/article/details/84874326

2.彻底解决
1.13.1版本支持AVX2

pip install --ignore-installed --upgrade https://github.com/lakshayg/tensorflow-build-archived/releases/download/tf1.13.1-ubuntu16.04-py3/tensorflow-1.13.1-cp35-cp35m-linux_x86_64.whl

将tensorflow导入到pycharm

https://blog.csdn.net/qq_36982160/article/details/79603927

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值