I downgraded my Python from 3.9 to 3.8, but Pip was still installing to 3.9 after the downgrade so I uninstalled Pip. I tried to reinstalling pip using: python get-pip.py
from pip's documentation and pip install --upgrade --force pip
, and both gives the same error:
ERROR: Exception:
Traceback (most recent call last):
File "/Users/Dan/Library/Python/3.8/lib/python/site-packages/pip/_internal/cli/base_command.py", line 180, in _main
status = self.run(options, args)
File "/Users/Dan/Library/Python/3.8/lib/python/site-packages/pip/_internal/cli/req_command.py", line 204, in wrapper
return func(self, options, args)
File "/Users/Dan/Library/Python/3.8/lib/python/site-packages/pip/_internal/commands/install.py", line 449, in run
self._handle_target_dir(
File "/Users/Dan/Library/Python/3.8/lib/python/site-packages/pip/_internal/commands/install.py", line 503, in _handle_target_dir
shutil.rmtree(target_item_dir)
File "/usr/local/Cellar/python@3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 718, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/local/Cellar/python@3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 675, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/local/Cellar/python@3.8/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 673, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'RECORD'
When I run pip
in terminal, I get:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
When I run which pip
, I get:
/usr/local/bin/pip
The PermissionError you get makes me think you're not running it as sudo, especially since it's trying to use os.unlink. Try as sudo and see if it works then!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.