WSL Ubuntu下无法安装/重装/卸载Matplotlib 3.9.1求助
问题:Matplotlib版本回退与重装失败(WSL Ubuntu 22.04 LTS)
我在WSL Ubuntu 22.04 LTS中将matplotlib升级至3.9.1,用于复现同事在我的程序中遇到的bug,但尝试回退到之前使用的3.5.1版本时,遇到了诸多问题:无法安装Matplotlib 3.5.1、无法强制重装Matplotlib 3.9.1,也无法彻底移除已存在的Matplotlib。
1. 安装Matplotlib 3.5.1失败
执行命令:
pip3 install matplotlib==3.5.1
出现以下错误:
Defaulting to user installation because normal site-packages is not writeable Collecting matplotlib==3.5.1 Using cached matplotlib-3.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.7 kB) Requirement already satisfied: cycler>=0.10 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (4.53.1) Requirement already satisfied: kiwisolver>=1.0.1 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (1.4.5) Requirement already satisfied: numpy>=1.17 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (2.0.0) Requirement already satisfied: packaging>=20.0 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (24.1) Requirement already satisfied: pillow>=6.2.0 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (10.4.0) Requirement already satisfied: pyparsing>=2.2.1 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (3.1.2) Requirement already satisfied: python-dateutil>=2.7 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (2.9.0.post0) Requirement already satisfied: six>=1.5 in ./.local/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib==3.5.1) (1.16.0) WARNING: No metadata found in ./.local/lib/python3.10/site-packages Using cached matplotlib-3.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.9 MB) WARNING: Error parsing dependencies of matplotlib: [Errno 2] No such file or directory: '/home/jjuvan25/.local/lib/python3.10/site-packages/matplotlib-3.9.1.dist-info/METADATA' Installing collected packages: matplotlib Attempting uninstall: matplotlib WARNING: No metadata found in ./.local/lib/python3.10/site-packages Found existing installation: matplotlib 3.9.1 error: uninstall-no-record-file × Cannot uninstall matplotlib 3.9.1 ╰─> The package's contents are unknown: no RECORD file was found for matplotlib. hint: You might be able to recover from this via: pip install --force-reinstall --no-deps matplotlib==3.9.1
2. 强制重装Matplotlib 3.9.1失败
执行错误提示的命令:
pip install --force-reinstall --no-deps matplotlib==3.9.1
仍出现相同错误:
Defaulting to user installation because normal site-packages is not writeable Collecting matplotlib==3.9.1 Using cached matplotlib-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (11 kB) WARNING: No metadata found in ./.local/lib/python3.10/site-packages Using cached matplotlib-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.3 MB) Installing collected packages: matplotlib Attempting uninstall: matplotlib WARNING: No metadata found in ./.local/lib/python3.10/site-packages Found existing installation: matplotlib 3.9.1 error: uninstall-no-record-file × Cannot uninstall matplotlib 3.9.1 ╰─> The package's contents are unknown: no RECORD file was found for matplotlib. hint: You might be able to recover from this via: pip install --force-reinstall --no-deps matplotlib==3.9.1
3. 卸载Matplotlib失败
执行命令:
pip uninstall matplotlib
同样返回该错误:
WARNING: No metadata found in ./.local/lib/python3.10/site-packages Found existing installation: matplotlib 3.9.1 error: uninstall-no-record-file × Cannot uninstall matplotlib 3.9.1 ╰─> The package's contents are unknown: no RECORD file was found for matplotlib. hint: You might be able to recover from this via: pip install --force-reinstall --no-deps matplotlib==3.9.1
即使使用sudo尝试移除并重装Matplotlib也失败了。我担心自己可能损坏了Python或Ubuntu的安装,虽有文件备份可重装,但希望能找到解决方案。
内容的提问来源于stack exchange,提问作者Jacob Juvan
相关产品推荐
相关产品推荐

