升级到python3.6后无法卸载全局python3.5模块

时间:2018-01-30 17:12:13

标签: python-3.x pip python-3.5 python-3.6

我最近从Ubuntu 17.04升级到17.10,以便能够收到崩溃补丁。这个升级自动让我从python3.5到python3.6,我没有任何问题。但是,我必须通过并重新安装我使用的所有小工具。一个很麻烦。

我使用名为tmuxp的工具,官方安装说明为pip install --user tmuxp。但是,似乎前段时间我在python3.5上全局安装了tmuxp,现在我的/user/local/bin中有一个可执行文件:

➜ maynard@buddha  ~  which tmuxp
/usr/local/bin/tmuxp

这意味着即使在运行pip install --user tmuxp之后,当我运行tmuxp时,我收到DistributionNotFound错误。

➜ maynard@buddha  ~  tmuxp
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 658, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 972, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 863, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (tmuxp 1.3.5 (/home/maynard/.local/lib/python3.6/site-packages), Requirement.parse('tmuxp==1.3.2'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/tmuxp", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3049, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3033, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3062, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 858, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'tmuxp==1.3.2' distribution was not found and
is required by the application

所以旧的python3.5 tmuxp二进制文件正在用新的python3.6站点包查找旧版本的旧版本。这应该是一个简单的解决方案。只需卸载tmuxp的python3.5版本即可。但是,当我使用pip3.5时,尝试卸载python3.6 tmuxp。

pip3.5 uninstall tmuxp
Uninstalling tmuxp-1.3.5:
  /home/maynard/.local/bin/tmuxp
  /home/maynard/.local/lib/python3.6/site-packages/tmuxp-1.3.5.dist-info/DESCRIPTION.rst
  ...
  /home/maynard/.local/lib/python3.6/site-packages/tmuxp/workspacebuilder.py

事实上,pip3.5列表甚至没有显示tmuxp,但我可以在/usr/local/lib/python3.5/dist-packages中看到它!

ls /usr/local/lib/python3.5/dist-packages
click                     kaptan                  powerline
click-6.7.dist-info       kaptan-0.5.8.egg-info   powerline_status-2.6.egg-info
colorama                  libtmux                 tmuxp
colorama-0.3.9.dist-info  libtmux-0.7.4.egg-info  tmuxp-1.3.2.egg-info

调用sudo也不起作用。 sudo ~/.local/bin/pip3.5 uninstall tmuxp再次尝试卸载tmuxp的python3.6版本。

我知道我可以删除/usr/local/bin/tmuxp中的二进制文件...但我想知道我是如何陷入这种混乱的,以及如何彻底摆脱它。

0 个答案:

没有答案