The first error message occurs because pip
does not have permission to write in that location, while it is trying to add libraries to your installation of Python.
The warning about upgrading pip
can usually be ignored, and I think if you tried to upgrade now, you’d run into the same permissions problem anyway.
Everything after that could be a consequence of not being able to install serial
.
We can see from the error message that pip
is running with Python 3.10 installed in the root of C:
This is an old version, and an odd place, considering you say you just downloaded and installed Python. When I install, I believe I do a “user” installation (there’s a “just for me” tick-box, I think) and so the files end up in my profile, which of course I can install to. Maybe you explicitly chose an old version and installed it there as an admin. Or maybe py
is pointing to an old version on your disk.
If you launched pip with py -m pip
, then it means py
is still defaulting to that installation that apparently you are not allowed to change. You can ask what versions you have with py --list
and the *
in the listing marks the default version it will use. I get:
PS vsj> py --list-paths
-V:3.13 * ...\AppData\Local\Programs\Python\Python313\python.exe
-V:3.12 ...\AppData\Local\Programs\Python\Python312\python.exe
-V:3.11 ...\AppData\Local\Programs\Python\Python311\python.exe
-V:3.10 ...\AppData\Local\Programs\Python\Python310\python.exe
-V:3.9 ...\AppData\Local\Programs\Python\Python39\python.exe
-V:3.8 ...\AppData\Local\Programs\Python\Python38\python.exe
-V:3.7 ...\AppData\Local\Programs\Python\Python37\python.exe
-V:3.6 ...\AppData\Local\Programs\Python\Python36\python.exe
-V:3.5 ...\AppData\Local\Programs\Python\Python35\python.exe
-V:2.7 C:\Python\2.7.18\python.exe
Hmm. I have been messing with Python for a long time. I don’t use py
all that much as long before it matured I wrote my own way of switching versions. I don’t know how one changes the default, but it seems to be the last installed or latest. The quick way to find out which version you’re about to use is:
py --version
By the way, when you quote code or error messages, enclose them in three back-ticks as explained here. And there are formatting elements that will allow you to
avoid shouting
when you don’t mean to. Unfortunately, it’s the Python comment character, so it happens a lot.