InvalidVersionSpecError: Invalid version spec: =2.7

conda updates/installs any package (including updating itself and reporting errors)

conda version 4.5.11 (too old)

anaconda version 5.3.0

solve:

1For other environments, please refer to my other post

Base environment: conda cannot be updated.

Lines 396 396396 of the file D:\Anaconda3\Lib\site-packages\conda\models\version.py start from

version_relation_re = re.compile(r'(==|!=|<=|>=|<|>)(?![=<>!])(\S+)$')
regex_split_re = re.compile(r'(\^\S+?\$)')
regex_split_converter = {
    '|': 'any',
    ',': 'all',
}
opdict = {'==': op.__eq__, '!=': op.__ne__, '<=': op.__le__,
          '>=': op.__ge__, '<': op.__lt__, '>': op.__gt__}

Change to

version_relation_re = re.compile(r'(==|!=|<=|>=|<|>|=)(?![=<>!])(\S+)$')
regex_split_re = re.compile(r'(\^\S+?\$)')
regex_split_converter = {
    '|': 'any',
    ',': 'all',
}
opdict = {'==': op.__eq__, '!=': op.__ne__, '<=': op.__le__, '=': lambda x, y: x.startswith(y),
          '>=': op.__ge__, '<': op.__lt__, '>': op.__gt__}

Stuck in solving environments when updating:

The University of Science and Technology of China and Tsinghua University no longer cooperate and use Alibaba:

conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/main
 
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/r
 
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/msys2
 
conda config --set show_channel_urls yes 

I directly updated conda to 22.x and reported the latest error: CondaError: Cannot link a source that does not exist.

There are still errors when downloading packages from some sources.

Select conda install conda=4.9.2

Guess you like

Origin blog.csdn.net/Mr_Pingg/article/details/131166502