我试图安装matplotlib,因为不知何故,我所有的python模块都丢失了,一切都出了问题,所以我正常使用
pip3 install matplotlib
,但是这会遇到一个错误:
ERROR: Exception:
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/shutil.py", line 806, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/private/var/folders/58/6kdshsgx3gj6k1pmsmst6fth0000gn/T/pip-target-5yt_jb8r/lib/python/packaging' -> '/Users/Bob/Library/Python/3.10/lib/python/site-packages/packaging'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 173, in _main
status = self.run(options, args)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 203, in wrapper
return func(self, options, args)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 446, in run
self._handle_target_dir(
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 505, in _handle_target_dir
shutil.move(
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/shutil.py", line 822, in move
copytree(src, real_dst, copy_function=copy_function,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/shutil.py", line 557, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/shutil.py", line 458, in _copytree
os.makedirs(dst, exist_ok=dirs_exist_ok)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/os.py", line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Users/Bob/Library/Python/3.10/lib/python/site-packages/packaging'
我尝试删除python3并用重新安装
brew uninstall python3
和
brew install python3
因为我认为python解释器路径是问题所在,但没有。我还从Applications文件夹中删除了python,并从网站上重新安装了它,但后来又出现了同样的问题。
问题是我不明白它为什么试图访问
/Users/Bob
,没有名为Bob的用户!如果有什么不同的话,那应该是
/Users/childish
,我尝试过使用不同的方法,例如
python3 -m pip install matplotlib
以及使用virtualenv,但所有这些都会导致相同的错误。
我也试过
pip3 install matplotlib --user
但这会导致不同的错误:
ERROR: Can not combine '--user' and '--target'
这应该是相互排斥的,根本不应该发生,我是否必须擦拭我的Mac并重新安装所有东西,或者这可能与MacOs Sonoma测试版有关?任何事情都会有帮助!