linux下构建虚拟环境(virtualenv )安装tensorflow

4 篇文章 0 订阅

tensorflow没有32位版本,所以在我的渣渣笔记本里是不可能装了,只能回校再说了。
原博:http://blog.csdn.net/batuwuhanpei/article/details/65445174

  • 首先要安装virtualenv
$ sudo apt-get install python-pip python-dev python-virtualenv 
   
   
  • 1
  • 创建虚拟环境(如果使用默认的python版本则无需-p命令,如果要用指定的python版本,则使用-p命令来指定;我们假定创建的虚拟环境为tensorflow,即targetDirectory为tensorflow)
$ virtualenv -p /usr/bin/期望使用的python版本 targetDirectory 
   
   
  • 1
  • 激活虚拟环境
$ source ~/tensorflow/bin/activate
   
   
  • 1
  • 激活之后的虚拟环境变为
(tensorflow)$
   
   
  • 1
  • 在激活的虚拟环境中安装TensorFlow
 (tensorflow)$ pip install --upgrade tensorflow      # for Python 2.7
 (tensorflow)$ pip3 install --upgrade tensorflow     # for Python 3.n
 (tensorflow)$ pip install --upgrade tensorflow-gpu  # for Python 2.7 and GPU
 (tensorflow)$ pip3 install --upgrade tensorflow-gpu # for Python 3.n and GPU
   
   
  • 1
  • 2
  • 3
  • 4
  • 如果上面的命令执行之后安装失败,则说明pip版本太低,无法通过https来下载,可以升级pip版本
 (tensorflow)$ pip install --upgrade TF_PYTHON_URL   # Python 2.7
 (tensorflow)$ pip3 install --upgrade TF_PYTHON_URL  # Python 3.N 
   
   
  • 1
  • 2
  • 如果升级失败,依然无法安装TF的话,则直接执行下面的命令,通常都可以安装成功

    • Python2.7(CPU/GPU)

      (tensorflow)$ pip install --ignore-installed --upgrade \
      https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp27-none-linux_x86_64.whl 
      
      (tensorflow)$ pip install --ignore-installed --upgrade \
      https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp27-none-linux_x86_64.whl
             
             
      • 1
      • 2
      • 3
      • 4
      • 5
    • Python3.4(CPU/GPU)

      (tensorflow)$ pip install --ignore-installed --upgrade \
      https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp34-cp34m-linux_x86_64.whl
      
      (tensorflow)$ pip install --ignore-installed --upgrade \
      https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp34-cp34m-linux_x86_64.whl
             
             
      • 1
      • 2
      • 3
      • 4
      • 5
    • Python3.5(CPU/GPU)

      (tensorflow)$ pip install --ignore-installed --upgrade \
      https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp35-cp35m-linux_x86_64.whl
      
      (tensorflow)$ pip install --ignore-installed --upgrade \
      https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp35-cp35m-linux_x86_64.whl
             
             
      • 1
      • 2
      • 3
      • 4
      • 5
    • Python3.6(CPU/GPU)

      (tensorflow)$ pip install --ignore-installed --upgrade \
      https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp36-cp36m-linux_x86_64.whl
      
      (tensorflow)$ pip install --ignore-installed --upgrade \
      https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp36-cp36m-linux_x86_64.whl
             
             
      • 1
      • 2
      • 3
      • 4
      • 5
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值