Tensorflow: why 'pip uninstall tensorflow' cannot find tensorflow

六眼飞鱼酱① 提交于 2020-01-01 07:43:36

问题


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

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

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

/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.

/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?

Thanks a lot for your help in advance!


回答1:


It could be because you didn't install Tensorflow using pip, but using python setup.py develop instead as your link shows.

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.

Therefore, you should be able to unistall Tensorflow with the option -u or --unistall of 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 answer on the topic.

PS: Tensorflow is a good library, you should consider not uninstall it :)




回答2:


I believe pip isn't installed for python2.7

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).

So I don't use pip binary as such, and rather, call pip module from inside python.

In your case :

python2.7 -m pip uninstall tensorflow


来源:https://stackoverflow.com/questions/39729787/tensorflow-why-pip-uninstall-tensorflow-cannot-find-tensorflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!