Python Tensorflow:为什么 'pip uninstall tensorflow' 找不到 tensorflow
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39729787/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tensorflow: why 'pip uninstall tensorflow' cannot find tensorflow
提问by ROBOT AI
I'm using Tensorflow-0.8 on Ubuntu14.04. I first install Tensorflow from sources and then setup Tensorflow for development according to the official tutorial. When I want to uninstall tensorflow using the following command
我在 Ubuntu14.04 上使用 Tensorflow-0.8。我首先从源代码安装 Tensorflow,然后根据官方教程设置 Tensorflow 进行开发。当我想使用以下命令卸载 tensorflow 时
sudo pip uninstall tensorflow
I encountered the following error:
我遇到了以下错误:
Can't uninstall 'tensorflow'. No files were found to uninstall
Could anyone tell me where is wrong?
谁能告诉我哪里错了?
For your reference, the output of
pip show tensorflow
is
供您参考,输出
pip show tensorflow
为
Name: tensorflow
Version: 0.8.0
Location: /home/AIJ/tensorflow/_python_build
Requires: numpy, six, protobuf, wheel
But I actually find another Tensorflow directory at
但我实际上在以下位置找到了另一个 Tensorflow 目录
/usr/local/lib/python2.7/dist-packages/tensorflow
Besides, I also have a question about the general usage of Python. I have seen two quite similar directories in my system, i.e.
另外,我还有一个关于Python的一般用法的问题。我在我的系统中看到了两个非常相似的目录,即
/usr/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages
Could any one tell me the differences between them? I noticed that everytime I use sudo pip install <package>
, the package will be installed to /usr/local/lib/python2.7/dist-packages
, could I instead install packages into /usr/lib/python2.7/dist-packages
using pip install
?
谁能告诉我它们之间的区别?我注意到每次使用时sudo pip install <package>
,软件包都会安装到/usr/local/lib/python2.7/dist-packages
,我可以将软件包安装到/usr/lib/python2.7/dist-packages
using 中pip install
吗?
Thanks a lot for your help in advance!
非常感谢您的帮助!
采纳答案by Kruup?s
It could be because you didn't install Tensorflow using pip
, but using python setup.py develop
instead as your linkshows.
这可能是因为你没有使用安装Tensorflowpip
,但使用python setup.py develop
而不是为你的链接显示。
pip uninstall
is likely to fail if the package is installed using python setup.py install
as they do not leave behind metadata to determine what files were installed.
pip uninstall
如果使用安装包,则可能会失败,python setup.py install
因为它们不会留下元数据来确定安装了哪些文件。
Therefore, you should be able to unistall Tensorflow with the option -u
or --unistall
of develop
因此,你应该能够反安装Tensorflow的选项-u
或--unistall
中develop
cd /home/AIJ/tensorflow/_python_build
python setup.py develop --uninstall
To answer for the second (interestring) question about the two dist-package
created under /usr/lib/python2.7
and /usr/local/lib/python2.7
it exists already a great Stack Overflow answeron the topic.
要回答关于在下面dist-package
创建的两个(有趣的)问题/usr/lib/python2.7
,/usr/local/lib/python2.7
它已经存在关于该主题的一个很棒的 Stack Overflow 答案。
PS: Tensorflow is a good library, you should consider notuninstall it :)
PS:Tensorflow 是一个很好的库,你应该考虑不要卸载它:)
回答by Lo?c
I believe pip isn't installed for python2.7
我相信 python2.7 没有安装 pip
try :
尝试 :
pip -V
On my system for instance it says :
例如在我的系统上它说:
pip 8.1.2 from /usr/lib/python3.4/site-packages (python 3.4)
So basically using pip uninstall
will only remove packages for python3.4 (and not python2.7).
所以基本上使用pip uninstall
只会删除python3.4(而不是python2.7)的包。
So I don't use pip binary as such, and rather, call pip module from inside python.
所以我不使用 pip 二进制文件,而是从 python 内部调用 pip 模块。
In your case :
在你的情况下:
python2.7 -m pip uninstall tensorflow