Fatal Python error on Windows 10 ModuleNotFoundError: No module named 'encodings'

前端 未结 8 1626
青春惊慌失措
青春惊慌失措 2020-12-01 20:50

I\'m installing python on my windows 10 laptop, and when I try to run it I get this.

Fatal Python error: Py_Initialize: unable to load the file system

相关标签:
8条回答
  • 2020-12-01 21:11

    I solved this issue by deleting my virtual environment and creating a new one. I believe in my case the error came because the old virtual environment was running on python 3.6, which I had recently uninstalled and replaced with python 3.8.

    This is probably bad practice in general, but I don't have any real projects where the version matters.

    0 讨论(0)
  • 2020-12-01 21:12

    Before installing the python, check environment and remove the existing PYTHONHOME, and python path under "PATH" of environment. Or change it to the new path to be installed.

    0 讨论(0)
  • 2020-12-01 21:13

    First, don't forget to select "Add Python 3.x to PATH" Before you click on Install now and reboot after installation so that the new path is taken into account by Windows. Second, I had the the same problem with Phython 3 on Windows 7 and 64-bit and I got rid of it by deleting PYTHONPATH and PYTHONHOME from Windows 7 system environment variables because I had a previous installation of python 2 and those paths were pointing to my python 2 directory. I had to simply to delete the PYTHONPATH and PYTHONHOME variables.

    0 讨论(0)
  • 2020-12-01 21:19

    This issue has been addressed here in this thread. Apparently, running python setup as an administrator AND/OR correctly setting the environment variables solved this issue.

    0 讨论(0)
  • 2020-12-01 21:23

    I ran into this same issue on Windows 10. Here's how I fixed it:

    1. Open your 'Environment Variables' (Under 'System Properties').
    2. In the window that opens, select the 'Path' row, then click the 'Edit...' button.
    3. There should be two environment variables C:\Python37-32\Scripts\ and C:\Python37-32\ Then click 'OK' (Make sure to check that these path values correspond to the location and version of your Python install.)
    4. Next, in the top portion of the 'Environment Variables' window, look for the PYTHONHOME variable and make sure that it is also set to C:\Python37-32
    0 讨论(0)
  • 2020-12-01 21:23

    I had the same problem (I use a mac but I don't think it makes any difference in this problem) and it was coming from the difference between the selected python interpreter path and the current working directory in spyder.

    I use virtual environments in python to avoid version conflicts of installed modules between various projects (I believe it is a good practice). This leads me ton configure the interpreter path in spyder by accessing :

    preferences > python interpreter > use the following interpreter
    

    The problem comes when I launch spyder from a different path. I get exactly the same error as Milo's. To solve it I see 2 options :

    1. change the interpreter path to match the spyder working directory
    2. change the spyder working directory to match the python interpreter path
    0 讨论(0)
提交回复
热议问题