Conda Error—AttributeError: ‘NoneType’ object has no attribute ‘loader’ for matplotlib
想要通过conda下载软件NanoPlot,下载后不合适卸载出现问题,报错:
Error processing line 1 of /home/debian/bin/miniconda3/lib/python3.8/site-packages/matplotlib-3.4.2-py3.8-nspkg.pth:
Traceback (most recent call last):
File "/home/debian/bin/miniconda3/lib/python3.8/site.py", line 169, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 553, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
Remainder of file ignored
在当前conda环境中,每次登录使用,都会输出这个错误,删除这个文件即可:
rm -f ~/bin/miniconda3/lib/python3.8/site-packages/matplotlib-3.4.2-py3.8-nspkg.pth
进入python查看matplotlib包没问题。
Python 3.8.2 (default, Mar 25 2020, 17:03:02)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
继续使用发现 mamba不好用了:
ImportError: cannot import name 'init_std_stream_encoding' from 'conda.common.compat' (/home/debian/bin/miniconda3/lib/python3.8/site-packages/conda/common/compat.py)
查找发现可以更新mamba:
conda update mamba -c conda-forge
的确更新完没问题了。
参考:
https://stackoverflow.com/questions/61810658/broken-update-conda-attributeerror-nonetype-object-has-no-attribute-loader
https://github.com/mamba-org/mamba/issues/1706