pip没有卸载软件包 [英] pip is not uninstalling packages

查看:93
本文介绍了pip没有卸载软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

我正在做一个学术项目,以(基本上)分析一些谁跟随谁"图,并想使用一个Python Twitter API包从Twitter获取一些真实数据(通过构建一些小的数据集),以便测试我的一些想法.

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)在pypi中被称为python-twitter,而(b)被称为twitter,所以这就是我将其引用的方式.

(a) is called python-twitter in pypi, and (b) is called twitter, so that's how I'll refer to them.

这两个都在Python解释器中由import twitter调用,但是当我写那行时,我总是得到twitter之一(如果我能弄清楚如何使用python-twitter的话,我会能够继续进行,但仍然存在相同的潜在问题.

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

问题

由于我不需要twitter软件包,因此我决定使用pip卸载它:

Since I don't need the twitter package, I decided to uninstall it with pip:

$ sudo pip uninstall twitter

给出输出:

Uninstalling twitter:
Proceed (y/n)? y
  Successfully uninstalled twitter

(实际上,我用python-twitter尝试了同样的事情,并且得到了类似的响应).

(actually, I tried the same thing with python-twitter and got a similar response).

但是,当运行pip freeze时,这两个软件包都显示在已安装列表中!实际上,我仍然可以在解释器中成功使用import twitter命令.显然,这些软件包尚未卸载.我想知道的是如何卸载它们!

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!

其他信息

我正在使用Python 2.7和Ubuntu 12.04

I'm using Python 2.7 and Ubuntu 12.04

在运行IDLE而不是Shell解释器时,如果键入help('modules'),则twitterpython-twitter都不会显示在列表中.在外壳解释器中键入help('modules')时,出现分段错误错误,解释器崩溃.这是错误:

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)


为什么其他问题没有为我解决这个问题:

我在 pip冻结列表中已卸载的软件包上看到了类似的帖子,有相同的问题.

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

这是相同的输出.另外,$ sudo pip freeze提供与$ pip freeze相同的输出.

which is the same output. In addition, $ sudo pip freeze gives the same output as $ pip freeze.

非常感谢您的帮助!

推荐答案

您始终可以手动删除软件包;您可以运行:

You can always manually delete the packages; you can run:

sudo rm -rf /usr/local/lib/python2.7/dist-packages/twitter

从您的dist-packages目录中删除该软件包.您可能必须在同一目录中编辑easy-install.pth文件,并从其中删除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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆