如何卸载由Pip安装的Python包引入的依赖项?

时间:2017-02-15 16:20:53

标签: python installation pip

我尝试安装PyLint。安装时我看到以下内容:

Collecting pylint
  Downloading pylint-1.6.5-py2.py3-none-any.whl (577kB)
    100% |████████████████████████████████| 583kB 655kB/s 
Collecting six (from pylint)
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting isort>=4.2.5 (from pylint)
  Downloading isort-4.2.5-py2.py3-none-any.whl (40kB)
    100% |████████████████████████████████| 40kB 737kB/s 
Collecting mccabe (from pylint)
  Downloading mccabe-0.6.1-py2.py3-none-any.whl
Collecting configparser; python_version == "2.7" (from pylint)
  Downloading configparser-3.5.0.tar.gz
Collecting backports.functools-lru-cache; python_version == "2.7" (from pylint)
  Downloading backports.functools_lru_cache-1.3-py2.py3-none-any.whl
Collecting astroid<1.5.0,>=1.4.5 (from pylint)
  Downloading astroid-1.4.9-py2.py3-none-any.whl (213kB)
    100% |████████████████████████████████| 215kB 713kB/s 
Collecting lazy-object-proxy (from astroid<1.5.0,>=1.4.5->pylint)
  Downloading lazy-object-proxy-1.2.2.tar.gz
Collecting wrapt (from astroid<1.5.0,>=1.4.5->pylint)
  Downloading wrapt-1.10.8.tar.gz
Building wheels for collected packages: configparser, lazy-object-proxy, wrapt
  Running setup.py bdist_wheel for configparser ... done
  Stored in directory: /Users/dkanesha/Library/Caches/pip/wheels/1c/bd/b4/277af3f6c40645661b4cd1c21df26aca0f2e1e9714a1d4cda8
  Running setup.py bdist_wheel for lazy-object-proxy ... done
  Stored in directory: /Users/dkanesha/Library/Caches/pip/wheels/06/d4/af/71508d0c69292f8c369ba3ae83cd85fabcd6956fd5709633b4
  Running setup.py bdist_wheel for wrapt ... done
  Stored in directory: /Users/dkanesha/Library/Caches/pip/wheels/19/8a/01/20cf74c3f38d49ef8e9b9aa7ffd38cefff79bad9f6f2c651f0
Successfully built configparser lazy-object-proxy wrapt
Installing collected packages: six, isort, mccabe, configparser, backports.functools-lru-cache, lazy-object-proxy, wrapt, astroid, pylint
Successfully installed astroid-1.4.9 backports.functools-lru-cache-1.3 configparser-3.5.0 isort-4.2.5 lazy-object-proxy-1.2.2 mccabe-0.6.1 pylint-1.6.5 six-1.10.0 wrapt-1.10.8

我是否可以卸载此处提到的软件包Installing collected packages: six, isort, mccabe, configparser, backports.functools-lru-cache, lazy-object-proxy, wrapt, astroid, pylint以恢复到以前的状态,或者“安装收集的软件包”是否也可以引用以前安装的软件包?

2 个答案:

答案 0 :(得分:1)

pip将明确地告诉你它究竟是做什么的。如果已经安装了所需的软件包,它们将不会被列入&#34;成功安装&#34;列表,它会说&#34;要求已经满足&#34;代替。如果在安装期间升级了依赖项,它将明确表示它找到了以前的版本,它卸载了以前的版本并且安装了新版本。

所以,是的,在您的情况下,它看起来不像是升级了任何旧软件包并且纯粹安装了新软件包,因此卸载所有这些软件包应该会将您恢复到以前的状态。

答案 1 :(得分:1)

有两个有用的软件包可以处理它。

使用软件包pip-autoremove卸载软件包及其依赖项。您也可以使用pipdeptree显示所有已安装软件包的树形关系。