1

I tried launching idle on the command prompt by using python -i -m idlelib This the error that occurred:

Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized  
Traceback (most recent call last):  
  File "C:\Users\_\AppData\Local\Programs\Python\Python38\lib\site.py", line 580, in <module>
    main()  
  File "C:\Users\_\AppData\Local\Programs\Python\Python38\lib\site.py", line 567, in main
    known_paths = addsitepackages(known_paths)  
  File "C:\Users\_\AppData\Local\Programs\Python\Python38\lib\site.py", line 350, in addsitepackages      
    addsitedir(sitedir, known_paths)  
  File "C:\Users\_\AppData\Local\Programs\Python\Python38\lib\site.py", line 208, in addsitedir  
    addpackage(sitedir, name, known_paths)  
  File "C:\Users\_\AppData\Local\Programs\Python\Python38\lib\site.py", line 164, in addpackage
    for n, line in enumerate(f):  
  File "C:\Users\_\AppData\Local\Programs\Python\Python38\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]  
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 654: character maps to undefined
fnthrshj
  • 11
  • 2
  • @superb rain My bad it was a typo, I did try `idlelib` – fnthrshj Jul 29 '20 at 03:46
  • Are you actually running Python 3.8? If not, the problem is probably that you hardcoded a `PYTHONPATH` which imports the libraries for 3.8 on all versions. – tripleee Jul 29 '20 at 05:18

1 Answers1

0

Try python -i first and see if you can access the idle on the console.

Once you've verified that, you should then open idle on your pc and try import idlelib. If it doesn't load that means that either you don't have that module or its not in you path (which you can fix by finding its location and running import sys; sys.path.append("path/to/module")).

My guess would be that you have multiple versions of python on your pc and when you're running python you are not using the version that has this module.

A person here seems to have had a similar problem, albeit with a different program where the environmental variables they used caused problems. I recommend getting a package like conda. That'll reduce the likelihood of running into these problems immensely.

Ariel A
  • 474
  • 4
  • 14