I have Python (3.9) installed to to my local user account programs folder. When I execute it, I get the following error. A few things that are odd:
- In my main Python script, I cannot even do a simple
print()
first thing, so the problem is directly with Python itself sys.path
has 2 entries that don't exist. I am not sure how they were set to those values, or what set them, but they are wrong as those paths don't exist and a third entry references a zip file, which is probably related to the issue I am having- I inspected all the paths manually and everything is as it should be, and the encodings module does exist
Python only exists in my PATH
environment variable once, which is:
C:\Users\<username>\AppData\Local\Programs\Python\Launcher\
and that Launcher folder doesn't exist, and I have no idea how it was even set as I intentionally told Python not to add itself to the PATH
variable so it would never interfere with other Python installations (which there currently are none).
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'C:\Users\<username>\AppData\Local\Programs\Python\python.exe'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = 'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\python.exe'
sys.base_prefix = ''
sys.base_exec_prefix = ''
sys.platlibdir = 'lib'
sys.executable = 'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\python.exe'
sys.prefix = ''
sys.exec_prefix = ''
sys.path = [
'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\python39.zip',
'C:\\Python39\\Lib\\',
'C:\\Python39\\DLLs\\',
'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x000071d4 (most recent call first):
<no Python frame>
If sys.path
is incorrect (which it appears as such), how can I manually set this, or fix it? Especially given that my script never gets the opportunity to execute