无法将 ubuntu 16.04 LTS 更新至 18.04 LTS

无法将 ubuntu 16.04 LTS 更新至 18.04 LTS

当我尝试使用以下命令升级到 Ubuntu 18.04(从 16.04 LTS)时:

sudo do-release-upgrade-d 复制代码

我收到以下错误:

Checking for a new Ubuntu release
Get:1 Upgrade tool signature [819 B]                                           
Get:2 Upgrade tool [1,257 kB]                                                  
Fetched 1,258 kB in 6s (28.4 kB/s)                                             
authenticate 'bionic.tar.gz' against 'bionic.tar.gz.gpg' 
extracting 'bionic.tar.gz'

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-98m3tlym/bionic", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-98m3tlym/DistUpgrade/DistUpgradeMain.py", line 224, in main
    from .DistUpgradeController import DistUpgradeController
  File "/tmp/ubuntu-release-upgrader-98m3tlym/DistUpgrade/DistUpgradeController.py", line 58, in <module>
    from .DistUpgradeQuirks import DistUpgradeQuirks
  File "/tmp/ubuntu-release-upgrader-98m3tlym/DistUpgrade/DistUpgradeQuirks.py", line 36, in <module>
    from janitor.plugincore.manager import PluginManager
  File "/tmp/ubuntu-release-upgrader-98m3tlym/janitor/__init__.py", line 20, in <module>
    import pkg_resources
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 956, in subscribe
    callback(dist)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2515, in activate
    declare_namespace(pkg)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2097, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2047, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'

我尝试使用以下命令更新并修复缺失问题,但问题仍然存在

sudo apt-get -f 安装

lsb_release 的输出如下

lsb_release -a

LSB Version:    core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
    Distributor ID: Ubuntu
    Description:    Ubuntu 16.04.4 LTS
    Release:    16.04
    Codename:   xenial

按照建议这里我修改了特殊字符,/var/lib/dpkg/status但问题仍然存在。

编辑1

我认为我的 python 出了问题,当我尝试使用以下命令从 pip 安装包时

pip install pyfaidx

我遇到了类似的错误

Traceback (most recent call last):
  File "/home/slsbioinfo/.local/bin/pip", line 7, in <module>
    from pip import main
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/__init__.py", line 26, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/utils/__init__.py", line 27, in <module>
    from pip._vendor import pkg_resources
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
    @_call_aside
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
    f(*args, **kwargs)
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
    dist.activate(replace=False)
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
    declare_namespace(pkg)
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/home/slsbioinfo/.local/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'

我该如何修复 Python?

编辑-2 问题解决了。

从源安装的 pip 安装工具重新安装 pip pip3

pip 安装--升级 pip setuptools

pip 安装-Ihttps://github.com/pypa/pip/archive/master.zip#egg=pip

答案1

问题解决了。

从源安装的 pip 安装工具重新安装 pip pip3

pip 安装--升级 pip setuptools

pip 安装-Ihttps://github.com/pypa/pip/archive/master.zip#egg=pip

相关内容