Mamba/Conda创建新环境遇包缓存损坏错误及VSCode环境识别问题
问题:Conda/Mamba创建环境时docutils包缓存损坏,VSCode无法识别本地Python环境
环境创建错误详情
执行命令创建新环境:
mamba create -c conda-forge -n env_name python=3.11 env_package=package_ver
初始过程正常,但随后报错:
warning libmamba Invalid package cache, file '/usr/local/Caskroom/mambaforge/base/pkgs/docutils-0.22.1-pyhd8ed1ab_0/site-packages/docutils/.__init__.py.swp' is missing error libmamba Cannot find a valid extracted directory cache for 'docutils-0.22.1-pyhd8ed1ab_0.conda'
改用Conda执行相同操作,同样失败:
Downloading and Extracting Packages: Preparing transaction: done Verifying transaction: failed CondaVerificationError: The package for docutils located at /usr/local/Caskroom/mambaforge/base/pkgs/docutils-0.22.1-pyhd8ed1ab_0 appears to be corrupted. The path 'site-packages/docutils/.__init__.py.swp' specified in the package manifest cannot be found.
已尝试的修复方法(均无效)
mamba clean -a micromamba self-update micromamba shell reinit rm -rf /usr/local/Caskroom/mambaforge/base/pkgs/docutils-0.22.1-pyhd8ed1ab_0 conda clean --all --yes conda update conda conda remove -n env_name --all conda install -n base -c conda-forge mamba
附加问题
修复过程中,VSCode无法识别本地Python环境,但远程环境可正常识别。
内容的提问来源于stack exchange,提问作者AstroTT




