简体   繁体   English

pip:需要将包名称tensorflow-gpu更改为tensorflow

[英]pip: need to change name of package tensorflow-gpu to tensorflow

I'm trying to install tensorflow with gpu support into a conda environment 我正在尝试使用gpu支持将tensorflow安装到conda环境中

I use the command: 我使用命令:

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-linux_x86_64.whl

When I look at the packages installed with conda list I wind up with a package called tensorflow-gpu. 当我查看使用conda list安装的软件包时,我最终得到了一个名为tensorflow-gpu的软件包。

You cannot even import this package because it has a '-' in it. 您甚至无法导入此包,因为它中包含“ - ”。

How can I change the name to 'tensorflow'? 如何将名称更改为“tensorflow”?

Edit: I'm now thinking that there must be something more to this. 编辑:我现在认为必须有更多的东西。 Why would a major package in the deep learning community have this apparent problem. 为什么深度学习社区中的一个主要方案会出现这个明显的问题。 Hopefully, a tensorflow expert can answer. 希望张量流专家可以回答。 I'm following the directions for Ubuntu and Anaconda here: https://www.tensorflow.org/install/install_linux 我在这里遵循Ubuntu和Anaconda的指示: https//www.tensorflow.org/install/install_linux

When you install the tensorflow gpu version, Anaconda will show that you have installed tensorflow-gpu. 当您安装tensorflow gpu版本时,Anaconda将显示您已安装tensorflow-gpu。 The -gpu just indicates that it is a gpu version and is not a part of the name. -gpu只表示它是一个gpu版本,不是名称的一部分。 You can still just import tensorflow and the gpu version will be found. 您仍然可以导入tensorflow并找到gpu版本。

I had a similar problem which was quite frustrating. 我有一个类似的问题非常令人沮丧。 I started with recently built .whl file and tried to install. 我从最近构建的.whl文件开始尝试安装。

pip install /home/ubuntu/xfer/tensorflow_gpu-1.2.1-cp27-none-linux_x86_64.whl

Command line testing: 命令行测试:

pip show tensorflow

no package called tensorflow 没有名为tensorflow的包

pip show tensorflow-gpu

but there is a package tensorflow-gpu at version 1.2.1 但版本1.2.1有一个包tensorflow-gpu

However, running one line in python failed despite assurances that conda would substitute: 但是,尽管保证conda会替换,但在python中运行一行失败了:

import tensorflow as tf

I then repeated the pip install of the .whl file with the --upgrade option: 然后我用--upgrade选项重复了.whl文件的pip安装:

pip install --upgrade /home/ubuntu/xfer/tensorflow_gpu-1.2.1-cp27-none-linux_x86_64.whl

And then the one line of python succeeded: 然后python的一行成功了:

import tensorflow as tf

And in fact based on https://www.tensorflow.org/install/install_linux#run_a_short_tensorflow_program , one would then run a slightly longer program which also succeeds: 事实上,基于https://www.tensorflow.org/install/install_linux#run_a_short_tensorflow_program ,然后运行一个稍长的程序也会成功:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM