我试图在Mac操作系统下使用命令pip3 uninstall numpy
卸载numpy
,但它引发了错误:
x@bogon ~ % pip3 uninstall numpy
Found existing installation: numpy 1.19.4
ERROR: Exception:
Traceback (most recent call last):
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
status = self.run(options, args)
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_internal/commands/uninstall.py", line 88, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 657, in uninstall
uninstalled_pathset = UninstallPathSet.from_dist(dist)
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 541, in from_dist
for path in uninstallation_paths(dist):
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 74, in unique
for item in fn(*args, **kw):
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 92, in uninstallation_paths
r = csv.reader(dist.get_metadata_lines('RECORD'))
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1432, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1420, in get_metadata
value = self._get(path)
File "/Users/x/anaconda3/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1616, in _get
with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/x/anaconda3/lib/python3.6/site-packages/numpy-1.19.4.dist-info/RECORD'
检查numpy
:的版本
x@bogon ~ % python3
Python 3.6.7 |Anaconda custom (x86_64)| (default, Oct 23 2018, 14:01:38)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.18.0'
有人可以帮助解决这个问题吗?谢谢
/Users/x/anaconda3/lib/python3.6/site-packages
:中有多个版本的Numpy
numpy
numpy-1.14.3.dist-info
numpy-1.18.0.dist-info
numpy-1.19.4.dist-info
出现此问题的原因是RECORD
和METADATA
文件不可用于numpy-1.19.4.dist-info
。所以我从numpy-1.18.0.dist-info
复制了它们,问题解决了。