Tensorflow:为什么“pip uninstall tensorflow”找不到tensorflow

2024-01-05

我在 Ubuntu14.04 上使用 Tensorflow-0.8。我首先从源安装 Tensorflow,然后根据以下内容设置 Tensorflow 进行开发官方教程 https://www.tensorflow.org/versions/r0.10/get_started/os_setup.html#setting-up-tensorflow-for-development。当我想使用以下命令卸载tensorflow时

sudo pip uninstall tensorflow

我遇到了以下错误:

Can't uninstall 'tensorflow'. No files were found to uninstall

谁能告诉我哪里错了?

供您参考,输出pip show tensorflow is

Name: tensorflow
Version: 0.8.0
Location: /home/AIJ/tensorflow/_python_build
Requires: numpy, six, protobuf, wheel

但我实际上找到了另一个 Tensorflow 目录

/usr/local/lib/python2.7/dist-packages/tensorflow

另外,我还有一个关于Python的一般用法的问题。我在我的系统中看到了两个非常相似的目录,即

/usr/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages

谁能告诉我它们之间的区别吗?我注意到每次我使用sudo pip install <package>,该包将被安装到/usr/local/lib/python2.7/dist-packages,我可以将软件包安装到/usr/lib/python2.7/dist-packages using pip install?

非常感谢您提前的帮助!


可能是因为你没有使用安装 Tensorflowpip https://www.tensorflow.org/versions/r0.10/get_started/os_setup.html#pip-installation,但是使用python setup.py develop相反作为你的link https://www.tensorflow.org/versions/r0.10/get_started/os_setup.html#setting-up-tensorflow-for-development shows.

pip uninstall如果使用安装包可能会失败python setup.py install因为它们不会留下元数据来确定安装了哪些文件。

因此,您应该能够使用以下选项安装 Tensorflow-u or --unistall of develop http://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode

cd /home/AIJ/tensorflow/_python_build
python setup.py develop --uninstall

回答关于两者的第二个(有趣的)问题dist-package创建于/usr/lib/python2.7 and /usr/local/lib/python2.7它已经存在了很好的堆栈溢出答案 https://stackoverflow.com/questions/9387928/whats-the-difference-between-dist-packages-and-site-packages关于这个话题。

PS:Tensorflow是一个很好的库,你应该考虑not卸载它:)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Tensorflow:为什么“pip uninstall tensorflow”找不到tensorflow 的相关文章

随机推荐