While working on a project, I changed my Ubuntu 20.04 default Python 3 version to Python 3.10, by doing the following changes
- in bashrc, added
alias python3 = python3.10
and sourced it ln -sf python3.10 python3
to mean that "python3 command means python3.10"
I know I messed up and rolled back these by
- removing the first line from bash and sourcing
- running the same command in 2 but with 3.8 replacing 3.10
However, now whenever I do any pip or pip3 install, I get this
build-system@buildsystem-H310M-H-2-0:~$ pip3 install pyserial
Collecting pyserial
Using cached pyserial-3.5-py2.py3-none-any.whl (90 kB)
Installing collected packages: pyserial
Successfully installed pyserial-3.5
ERROR: Exception:
Traceback (most recent call last):
File "/home/build-system/.local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
File "/home/build-system/.local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
File "/home/build-system/.local/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 553, in run
self._handle_target_dir(
File "/home/build-system/.local/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 563, in _handle_target_dir
ensure_dir(target_dir)
File "/home/build-system/.local/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 105, in ensure_dir
os.makedirs(path)
File "/usr/lib/python3.10/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/lib/python3.10/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File "/usr/lib/python3.10/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
[Previous line repeated 4 more times]
File "/usr/lib/python3.10/os.py", line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Users'
Whenever I put commands to check for the current version such as
python3 -V
which python
I get 3.8.10. Is this the default for Ubuntu 20.04?
Please tell me why is this happening despite rolling back from 3.10 to 3.8(default) and what do I need to do to fix this?
pip3 --version
say? Contrary to David's, I'm not convinced this problem is hard to fix.