pip uninstall 不会完全删除包
pip uninstall does not remove package fully
长话短说,当我导入 matplotlib 时,numpy 给了我错误,所以我想 pip uninstall numpy
并重新安装它。但无法完全卸载 numpy。
RuntimeError Traceback (most recent call last)
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/tmp/ipykernel_26902/2971697587.py in <module>
----> 1 import matplotlib
~/.local/lib/python3.7/site-packages/matplotlib/__init__.py in <module>
105 # cbook must import matplotlib only within function
106 # definitions, so it is safe to import from it here.
--> 107 from . import _api, cbook, docstring, rcsetup
108 from matplotlib.cbook import MatplotlibDeprecationWarning, sanitize_sequence
109 from matplotlib.cbook import mplDeprecation # deprecated
~/.local/lib/python3.7/site-packages/matplotlib/rcsetup.py in <module>
24 from matplotlib import _api, animation, cbook
25 from matplotlib.cbook import ls_mapper
---> 26 from matplotlib.colors import Colormap, is_color_like
27 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
28 from matplotlib._enums import JoinStyle, CapStyle
~/.local/lib/python3.7/site-packages/matplotlib/colors.py in <module>
80 import matplotlib as mpl
81 import numpy as np
---> 82 from matplotlib import _api, cbook, scale
83 from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, XKCD_COLORS
84
~/.local/lib/python3.7/site-packages/matplotlib/scale.py in <module>
16 import matplotlib as mpl
17 from matplotlib import _api, docstring
---> 18 from matplotlib.ticker import (
19 NullFormatter, ScalarFormatter, LogFormatterSciNotation, LogitFormatter,
20 NullLocator, LogLocator, AutoLocator, AutoMinorLocator,
~/.local/lib/python3.7/site-packages/matplotlib/ticker.py in <module>
177 import matplotlib as mpl
178 from matplotlib import _api, cbook
--> 179 from matplotlib import transforms as mtransforms
180
181 _log = logging.getLogger(__name__)
~/.local/lib/python3.7/site-packages/matplotlib/transforms.py in <module>
44
45 from matplotlib import _api
---> 46 from matplotlib._path import (
47 affine_transform, count_bboxes_overlapping_bbox, update_path_extents)
48 from .path import Path
ImportError: numpy.core.multiarray failed to import
网上查的解决办法都不行,决定卸载重装。
(ImportError: numpy.core.multiarray failed to import)
pi@raspberrypi:~ $ pip uninstall numpy
Uninstalling numpy-1.16.6:
Would remove:
/home/pi/.local/bin/f2py
/home/pi/.local/bin/f2py2
/home/pi/.local/bin/f2py2.7
/home/pi/.local/lib/python2.7/site-packages/numpy-1.16.6.dist-info/*
/home/pi/.local/lib/python2.7/site-packages/numpy/*
Proceed (y/n)? y
Successfully uninstalled numpy-1.16.6
pi@raspberrypi:~ $ pip install numpy
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages (1.16.2)
假设第一个命令已经卸载了numpy,为什么要求已经满足了?
pip uninstall
和 pip3 uninstall
我都试过了。然后还进入 python
和 python3
导入模块作为双重检查以查看模块是否仍然安装。模块导入成功。
同样在 /usr/lib/python2.7/dist-packages
文件夹中,numpy
仍然存在。
问题是什么?
如何成功卸载并重新安装 numpy?
编辑:我手动进入了python所有版本的dist-packages
目录,以及rm
所有与numpy相关的文件。然后重新安装工作。
您可以使用此命令删除文件
rm -rf f2py
rm -rf 2py2
rm -rf numpy-1.16.6.dist-info/*
rm -rf numpy/*
或仅:
rm f2py
rm 2py2
rm numpy-1.16.6.dist-info/*
rm numpy/*
长话短说,当我导入 matplotlib 时,numpy 给了我错误,所以我想 pip uninstall numpy
并重新安装它。但无法完全卸载 numpy。
RuntimeError Traceback (most recent call last)
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/tmp/ipykernel_26902/2971697587.py in <module>
----> 1 import matplotlib
~/.local/lib/python3.7/site-packages/matplotlib/__init__.py in <module>
105 # cbook must import matplotlib only within function
106 # definitions, so it is safe to import from it here.
--> 107 from . import _api, cbook, docstring, rcsetup
108 from matplotlib.cbook import MatplotlibDeprecationWarning, sanitize_sequence
109 from matplotlib.cbook import mplDeprecation # deprecated
~/.local/lib/python3.7/site-packages/matplotlib/rcsetup.py in <module>
24 from matplotlib import _api, animation, cbook
25 from matplotlib.cbook import ls_mapper
---> 26 from matplotlib.colors import Colormap, is_color_like
27 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
28 from matplotlib._enums import JoinStyle, CapStyle
~/.local/lib/python3.7/site-packages/matplotlib/colors.py in <module>
80 import matplotlib as mpl
81 import numpy as np
---> 82 from matplotlib import _api, cbook, scale
83 from ._color_data import BASE_COLORS, TABLEAU_COLORS, CSS4_COLORS, XKCD_COLORS
84
~/.local/lib/python3.7/site-packages/matplotlib/scale.py in <module>
16 import matplotlib as mpl
17 from matplotlib import _api, docstring
---> 18 from matplotlib.ticker import (
19 NullFormatter, ScalarFormatter, LogFormatterSciNotation, LogitFormatter,
20 NullLocator, LogLocator, AutoLocator, AutoMinorLocator,
~/.local/lib/python3.7/site-packages/matplotlib/ticker.py in <module>
177 import matplotlib as mpl
178 from matplotlib import _api, cbook
--> 179 from matplotlib import transforms as mtransforms
180
181 _log = logging.getLogger(__name__)
~/.local/lib/python3.7/site-packages/matplotlib/transforms.py in <module>
44
45 from matplotlib import _api
---> 46 from matplotlib._path import (
47 affine_transform, count_bboxes_overlapping_bbox, update_path_extents)
48 from .path import Path
ImportError: numpy.core.multiarray failed to import
网上查的解决办法都不行,决定卸载重装。 (ImportError: numpy.core.multiarray failed to import)
pi@raspberrypi:~ $ pip uninstall numpy
Uninstalling numpy-1.16.6:
Would remove:
/home/pi/.local/bin/f2py
/home/pi/.local/bin/f2py2
/home/pi/.local/bin/f2py2.7
/home/pi/.local/lib/python2.7/site-packages/numpy-1.16.6.dist-info/*
/home/pi/.local/lib/python2.7/site-packages/numpy/*
Proceed (y/n)? y
Successfully uninstalled numpy-1.16.6
pi@raspberrypi:~ $ pip install numpy
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages (1.16.2)
假设第一个命令已经卸载了numpy,为什么要求已经满足了?
pip uninstall
和 pip3 uninstall
我都试过了。然后还进入 python
和 python3
导入模块作为双重检查以查看模块是否仍然安装。模块导入成功。
同样在 /usr/lib/python2.7/dist-packages
文件夹中,numpy
仍然存在。
问题是什么?
如何成功卸载并重新安装 numpy?
编辑:我手动进入了python所有版本的dist-packages
目录,以及rm
所有与numpy相关的文件。然后重新安装工作。
您可以使用此命令删除文件
rm -rf f2py
rm -rf 2py2
rm -rf numpy-1.16.6.dist-info/*
rm -rf numpy/*
或仅:
rm f2py
rm 2py2
rm numpy-1.16.6.dist-info/*
rm numpy/*