马春杰杰 Exit Reader Mode

TypeError: ‘<' not supported between instances of 'str' and 'NoneType'

这个问题一般出现在升级conda版本之后,可以见该问题:

此时就可能会出现:

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1001, in __call__
        return func(*args, **kwargs)
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 81, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/main_list.py", line 142, in execute
        show_channel_urls=context.show_channel_urls)
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/main_list.py", line 80, in print_packages
        show_channel_urls=show_channel_urls)
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/cli/main_list.py", line 45, in list_packages
        installed = sorted(PrefixData(prefix, pip_interop_enabled=True).iter_records(),
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/core/prefix_data.py", line 116, in iter_records
        return itervalues(self._prefix_records)
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/core/prefix_data.py", line 145, in _prefix_records
        return self.__prefix_records or self.load() or self.__prefix_records
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/core/prefix_data.py", line 69, in load
        self._load_site_packages()
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/core/prefix_data.py", line 258, in _load_site_packages
        python_record = read_python_record(self.prefix_path, af, python_pkg_record.version)
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/gateways/disk/read.py", line 253, in read_python_record
        paths_tups = pydist.get_paths()
      File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/conda/common/pkg_formats/python.py", line 267, in get_paths
        records = sorted(concatv(records, ((pf, None, None) for pf in missing_pyc_files)))
    TypeError: '<' not supported between instances of 'str' and 'NoneType'

`$ /home/ubuntu/anaconda3/bin/conda list`

  environment variables:
                ALL_PROXY=<set>
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=detect
                CONDA_EXE=/home/ubuntu/anaconda3/bin/conda
CONDA_MKL_INTERFACE_LAYER_BACKUP=
             CONDA_PREFIX=/home/ubuntu/anaconda3/envs/detect
           CONDA_PREFIX_1=/home/ubuntu/anaconda3
    CONDA_PROMPT_MODIFIER=(detect)
         CONDA_PYTHON_EXE=/home/ubuntu/anaconda3/bin/python
               CONDA_ROOT=/home/ubuntu/anaconda3
              CONDA_SHLVL=2
       CPLUS_INCLUDE_PATH=:/home/ubuntu/bigdisk/part1/gsl2.4/include:/home/ubuntu/bigdisk/part1/
                          gsl2.4/include:/home/ubuntu/bigdisk/part1/gsl2.4/include:/home/ubuntu/
                          bigdisk/part1/gsl2.4/include
                CUDA_PATH=/home/ubuntu/anaconda3/envs/detect
           C_INCLUDE_PATH=:/home/ubuntu/bigdisk/part1/gsl2.4/include:/home/ubuntu/bigdisk/part1/
                          gsl2.4/include:/home/ubuntu/bigdisk/part1/gsl2.4/include:/home/ubuntu/
                          bigdisk/part1/gsl2.4/include
       GLADE_CATALOG_PATH=:
        GLADE_MODULE_PATH=:
        GLADE_PIXMAP_PATH=:
          LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64:::/home/ubuntu/bigdisk/part1/gsl2.4/lib::/h
                          ome/ubuntu/bigdisk/part1/gsl2.4/lib::/home/ubuntu/bigdisk/part1/gsl2.4
                          /lib
             LIBRARY_PATH=::/home/ubuntu/bigdisk/part1/gsl2.4/lib::/home/ubuntu/bigdisk/part1/gs
                          l2.4/lib::/home/ubuntu/bigdisk/part1/gsl2.4/lib::/home/ubuntu/bigdisk/
                          part1/gsl2.4/lib
                     PATH=/home/ubuntu/anaconda3/envs/detect/bin:/home/ubuntu/bin:/home/ubuntu/.
                          local/bin:/usr/local/cuda-11.2/bin:/home/ubuntu/anaconda3/bin:/usr/loc
                          al/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/l
                          ocal/games:/snap/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : detect
    active env location : /home/ubuntu/anaconda3/envs/detect
            shell level : 2
       user config file : /home/ubuntu/.condarc
 populated config files : /home/ubuntu/.condarc
          conda version : 4.6.1
    conda-build version : 3.15.1
         python version : 3.7.0.final.0
       base environment : /home/ubuntu/anaconda3  (writable)
           channel URLs : http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/noarch
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64
                          http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch
          package cache : /home/ubuntu/anaconda3/pkgs
                          /home/ubuntu/.conda/pkgs
       envs directories : /home/ubuntu/anaconda3/envs
                          /home/ubuntu/.conda/envs
               platform : linux-64
             user-agent : conda/4.6.1 requests/2.19.1 CPython/3.7.0 Linux/4.15.0-142-generic ubuntu/16.04.5 glibc/2.27
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?

这种一般是升级版本的时候一次性跳过太多了,例如升级前是4.5.11,那么最好是升级4.5.xx版本。

所以,打开:https://anaconda.org/anaconda/conda/files?version=4.5.13,然后挑一个合适的版本下载

最后使用conda install xxx.bz2安装即可。当然,还有一个解决方案,那就是重新安装一下之前的anaconda安装包即可,不用担心,环境都还在。

如果想升级到更高的版本怎么办呢?直接使用:

conda install conda=4.6.2

即可。

本文最后更新于2022年6月25日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!