【问题标题】:how to uninstall all python packages如何卸载所有python包
【发布时间】:2016-02-25 18:04:25
【问题描述】:

我刚刚更新了numpy,好像matplotlib和最新版的numpy有冲突。我有matplotlib 1.1.1rc。我尝试使用以下命令升级matplotlib

sudo pip install --upgrade matplotlib

我收到以下警告:

The directory '/home/po/.cache/pip/http' or its parent directory is not owned by 
the current user and the cache has been disabled. Please check the permissions and
owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

该软件包已下载并安装,在该过程结束时我收到以下信息:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-yq3kB5/matplotlib

我正在考虑卸载所有软件包,然后重新安装它们。有没有快速的方法来做到这一点?

编辑 1

我在终端里写了:

sudo -H pip install -U matplotlib

我得到了以下信息:

/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Collecting matplotlib
  Downloading matplotlib-1.5.0.tar.gz (54.0MB)
    100% |████████████████████████████████| 54.0MB 7.3kB/s 
    Complete output from command python setup.py egg_info:
    ============================================================================
    Edit setup.cfg to change the build options`

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.0]
                    python: yes [2.7.3 (default, Jun 22 2015, 19:33:41)  [GCC
                            4.6.3]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.10.1]
                  dateutil: yes [using dateutil version 2.4.2]
                      pytz: yes [using pytz version 2015.7]
                    cycler: yes [cycler was not found. pip will attempt to
                            install it after matplotlib.]
                   tornado: yes [using tornado version 4.2.1]
                 pyparsing: yes [matplotlib requires pyparsing >= 1.5.6]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype2 (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]
                       png: yes [version 1.2.46]
                     qhull: yes [pkg-config information for 'qhull' could not be
                            found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [using nose version 1.1.2 / mock is required to
                            run the matplotlib test suite. "setup.py test" will
                            automatically download it. Install mock to run
                            matplotlib.test()]
            toolkits_tests: yes [using nose version 1.1.2 / mock is required to
                            run the matplotlib test suite. "setup.py test" will
                            automatically download it. Install mock to run
                            matplotlib.test()]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt5agg: no  [PyQt5 not found]
                    qt4agg: yes [installing, Qt: 4.8.1, PyQt: 4.8.1; PySide not
                            found]
                   gtk3agg: yes [installing, version 3.2.4]
                 gtk3cairo: yes [installing, version 3.2.4]
                    gtkagg: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                            be found.  You may need to install the development
                            package.]
                     tkagg: no  [The C/C++ header for Tk (tk.h) could not be
                            found.  You may need to install the development
                            package.]
                     wxagg: no  [requires wxPython]
                       gtk: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                            be found.  You may need to install the development
                            package.]
                       agg: yes [installing]
                     cairo: yes [installing, pycairo version 1.8.8]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: yes [version 1.14]
               ghostscript: yes [version 9.05]
                     latex: yes [version 3.1415926]
                   pdftops: yes [version 0.18.4]

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

    ============================================================================
                            * The following required packages can not be built:
                            * freetype

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-elVWaU/matplotlib
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

但是当我关闭python时,重新加载它,然后写:

import matplotlib

matplotlib.__version__

我收到1.1.1rc

【问题讨论】:

  • 你不需要这样做。首先,按照警告的说明使用sudo -H pip install -U matplotlib。如果您仍有问题,请edit您的问题并发布整个回溯。
  • 我试过了,然后我写了matplotlib.__version__。版本还是`1.1.1rc1。检查编辑以获取详细信息。 @MattDMo
  • 尝试使用操作系统的包管理器安装freetype-devlibfreetype-dev,因为这似乎是导致错误的原因。 SSL 警告只是一个警告,但我建议您访问该链接并按照那里的说明进行操作。
  • @MattDMo,还是不行!有什么想法吗?
  • 附带说明,这是为什么将sudo pip install 放入系统目录被认为是不好的做法的一个示例。如果您已在本地安装,例如安装到 virtualenv 或使用 pip install --user 在您的主目录中,那么如果所有其他方法都失败了,您可以安全地删除包含损坏模块的整个目录并重新开始。

标签: python numpy matplotlib uninstallation


【解决方案1】:

终于成功了,这就是我所做的:

首先,我使用以下命令卸载了 matplotlib:

sudo apt-get remove python-matplotlib

然后,因为pip没有安装系统级依赖,所以我使用命令下载了freetype

apt-get install libfreetype6-dev

然后,我使用命令重新安装了matplotlib

sudo -H pip install matplotlib

注意: 我猜uninstallingreinstalling matplotlib 毫无意义。我可以先安装freetype,然后升级matplotlib,使用:

sudo -H pip install -U matplotlib

【讨论】:

  • 不过,这并没有回答您提出的问题,即:如何卸载所有 python 包
猜你喜欢
  • 2017-07-08
  • 1970-01-01
  • 2011-12-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-20
  • 2014-08-29
  • 2015-06-27
相关资源
最近更新 更多