pip 没有卸载软件包 [英] pip is not uninstalling packages
问题描述
背景
我正在开展一个学术项目,以(基本上)分析一些谁关注谁"的图表,并希望使用 Python Twitter API 包之一从 Twitter 获取一些真实数据(通过构建一些小数据集),以便测试我的一些想法.
我有点粗心,安装了两个包:
a) python-twitter0.8.2
(http://pypi.python.org/pypi/python-twitter/0.8.2)
b) twitter1.9.1
(http://pypi.python.org/pypi/twitter/1.9.1)
(a) 在 pypi 中被称为 python-twitter
,而 (b) 被称为 twitter
,所以我将这样称呼它们.
这两个都由 Python 解释器中的 import twitter
调用,但是当我写那行时,我总是得到 twitter
一个(如果我能弄清楚如何使用 python-twitter
一个,我将能够继续,但仍然会遇到相同的潜在问题).
问题
由于我不需要twitter
包,我决定用pip卸载它:
$ sudo pip卸载推特
给出输出:
卸载推特:继续(是/否)?是推特卸载成功
(实际上,我用 python-twitter
尝试了同样的事情并得到了类似的响应).
然而,当运行 pip freeze
时,这两个包都会出现在安装列表中!事实上,我仍然可以在解释器中成功使用 import twitter
命令.显然,这些软件包尚未卸载.我很想知道如何卸载它们!
其他信息
我使用的是 Python 2.7 和 Ubuntu 12.04
当运行 IDLE 而不是 shell 解释器时,我输入 help('modules')
,twitter
和 python-twitter
都不显示在列表中.在 shell 解释器中输入 help('modules')
时,出现分段错误,解释器崩溃.这是错误:
<小时>
为什么其他问题没有为我解决这个问题:
我查看了 pip freeze 列出了已卸载的软件包 上的类似帖子,但我没有有同样的问题.
$ sudo which pip/usr/bin/pip$哪个点/usr/bin/pip
这是相同的输出.此外,$ sudo pip freeze
给出与 $ pip freeze
相同的输出.
非常感谢任何帮助!
您可以随时手动删除包;你可以运行:
sudo rm -rf/usr/local/lib/python2.7/dist-packages/twitter
从您的 dist-packages
目录中删除该包.您可能需要编辑同一目录中的 easy-install.pth
文件并从中删除 twitter
条目.
Background
I'm working on an academic project to (basically) analyze some "who follows whom" graphs and wanted to get some real data (by building some small datasets) from Twitter using one of the Python Twitter API packages in order to test some ideas I have.
I was a bit careless and installed two packages:
a) python-twitter0.8.2
(http://pypi.python.org/pypi/python-twitter/0.8.2)
b) twitter1.9.1
(http://pypi.python.org/pypi/twitter/1.9.1)
(a) is called python-twitter
in pypi, and (b) is called twitter
, so that's how I'll refer to them.
Both of these are called by import twitter
in the Python interpreter, but when I write that line, I always get the twitter
one (if I can figure out how to use the python-twitter
one, I'll be able to proceed, but will still have the same underlying problem).
Problem
Since I don't need the twitter
package, I decided to uninstall it with pip:
$ sudo pip uninstall twitter
which gives the output:
Uninstalling twitter:
Proceed (y/n)? y
Successfully uninstalled twitter
(actually, I tried the same thing with python-twitter
and got a similar response).
However, when running pip freeze
, both of these packages show up on the installed list! In fact, I can still use the import twitter
command successfully in the interpreter. Clearly the packages have not been uninstalled. What I would love to know is how to uninstall them!
Other Info
I'm using Python 2.7 and Ubuntu 12.04
When running IDLE instead of the shell interpreter, and I type help('modules')
, neither twitter
nor python-twitter
shows up in the list. When typing help('modules')
into the shell interpreter, I get a segmentation fault error, and the interpreter crashes. Here's the error:
>>> help('modules')
Please wait a moment while I gather a list of all available modules...
/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning:
g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
import gobject._gobject
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning:
g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
from gtk import _gtk
** (python:2484): CRITICAL **: pyg_register_boxed: assertion `boxed_type != 0' failed
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: cannot register
existing type `GdkDevice'
from gtk import _gtk
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata:
assertion `node != NULL' failed
from gtk import _gtk
Segmentation fault (core dumped)
Why other questions have not resolved this for me:
I looked at the similar post at pip freeze lists uninstalled packages and am not having the same issues.
$ sudo which pip
/usr/bin/pip
$ which pip
/usr/bin/pip
which is the same output. In addition, $ sudo pip freeze
gives the same output as $ pip freeze
.
Any help is very much appreciated!
You can always manually delete the packages; you can run:
sudo rm -rf /usr/local/lib/python2.7/dist-packages/twitter
to remove that package from your dist-packages
directory. You may have to edit the easy-install.pth
file in the same directory and remove the twitter
entry from it.
这篇关于pip 没有卸载软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!