For Python 3.8.10 under Windows 7, I changed PYTHONUSERBASE from C:\Users\Username\AppData\Roaming\Python to C:\Users\Username\AppData\Local\Python by adding a PYTHONUSERBASE environment variable and checking the output of site.getuserbase():
C:\Users\Username>python
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> site.getuserbase()
'C:\\Users\\Username\\AppData\\Local\\Python38\\Lib\\site-packages'
>>>
But pip won't listen and keeps storing to Roaming:
C:\>pip config set global.target C:\Users\Username\AppData\Local\Python38\Lib\site-packages
Writing to C:\Users\Username\AppData\Roaming\pip\pip.ini
How to force pip and any other component that might still be looking in Roaming to only see Local?