This article discoursed by MiniTool Software gathers some information about “Fatal Python error: Py_Initialize: unable to load the file system codec” and “Fatal Python error: Initfsencoding: unable to load the file system codec”. Hope it can help you to some extent!
About “Fatal Python Error Unable to Load the File System Codec”
You may encounter A Fatal Python error: Py_Initialize: unable to load the file system codec problem when you try to make use of Python language for programming on your computer. For example, when you input:
Int main (int, char**)
You may get the output:
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
As the error message indicates, the issue occurs during initializing Python in your program. The C or C++ compiler can’t load the Python system codec file, which is in charging of encoding and decoding the Python program. The possible causes are listed below.
- The system cannot locate Python for it isn’t available in system/environment variables.
- Python hasn’t been installed properly.
- Two or more Python versions are available.
Next, let’s see the solutions for this error in different system environments.
Fix “Fatal Python Error: Unable to Load the File System Codec” in Windows 11/10
According to the possible reasons, you need to properly install the Python as well as set the Python path in system/environment variables.
1. Search for “edit the system environment variables” in Windows Search and open the matched result.
2. In the new popup named System Properties, click the Environment Variables…
3. In the next window, if there is any Python path under the User variables for xxx, just click on it and select Delete.
4. Then, choose Path under System variables and click the New button to add the Python path.
In this way, you are able to add the Python path to the environment variables.
Fix “Py_Initialize: Unable to Load the File System Codec” in MacOS
If you come across the same error in Apple Mac operating system (OS), the causes are the same as in the Windows environment. Yet, the solution for the Mac system is a little bit different. In macOS, you should find the .bash_profile or .bashrc file and add this command to the file.
Then, you can take advantage of the below command to set the variables.
Fix “Fatal Python Error Py_Initialize Unable to Load the File System Codec” in Ubuntu/Debian
Also, you have a chance to receive this error code within the Linux-based Ubuntu or Debian operating system for the same reasons. Also, the fix is unlike. There, you have to open the terminal and perform the following command.
$ export PYTHONHOME=/usr/local/lib/python3.5/
$ export PYTHONPATH=/usr/local/lib/pathon3.5/
You may receive the message – error loading Python DLL – when trying to open or sync the Google Drive on your device.
Fix “Fatal Python Error: Py_Initialize: Unable to Load the File System Codec” in Other OSes
The following are the commands to deal with the error in other operating systems.
this command line will append the “/sur/local/bin/python” path in the existing path.
To handle the problem in the Anaconda system, you need to add the Anaconda path in the path variable.
when you get the output, add that to the environmental variable of the system following the guide above according to your system.
# Jupyter Notebook
If you get the error, it may be due to that your local computer is not finding the path to Python as the jupyter notebook gets hosted on your local computer. To deal with this situation, you must specify the Python path in environment variables following the above instructions based on your own OS.
Why does Chromebook file system error camera happen? How to solve the problem? Read this post and pick up the solution that works for you.
Fix “Fatal Python Error: Initfsencoding: Unable to Load the File System Codec”
You may get this error when both Python 3 and Python 2 exist and one of the two fails to start.
#1 File error in Python3 path failed to start Python2
File “E:\Python37\Lib\site.py”, line 177
SyntaxError: invalid syntax
#2 File error in Python2 path failed to start Python3
Fatal Python error: initfsencoding: Unable to load the file system codec
file “C:\Python27\Lib\encodings\__init__. Py “, line 123
SyntaxError: invalid syntax
Current thread 0x000004dc (most recent call first):
# Solve the Errors
Those two cases in return the same. The reason is to set the environment variable PYTHONPATH, which is the Python search path. The default module will search from the PYTHONPATH while the environment variable is set to one version of the module paths resulting in another module version loading path error when trying to start, further leading launch failure.
Therefore, the environment variable needs to be configured when the custom module is no longer in C:\Pythonxx\Lib.
If you meet a Blue Screen with stop code VIDEO DXGKRNL FATAL ERROR on Windows 10 and don’t know how to fix it, then you can find methods in this post.
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module
named'encodings ' Current thread 0x00001080 (most recent call first)
In Ubuntu operating system, you can downgrade Python using Anaconda or upgrade Anaconda to the latest version.
- Audio Codec (Encoder + Decoder): How to Compare and Convert It?
- Video Encoder and Video Codecs: How to Change Video Encoder?
Windows 11 Assistant Software Recommended
The new and powerful Windows 11 will bring you many benefits. At the same time, it will also bring you some unexpected damages such as data loss. Thus, it is strongly recommended that you back up your crucial files before or after upgrading to Win11 with a robust and reliable program like MiniTool ShadowMaker, which will assist you to protect your increasing data automatically on schedules!
- How to Record a Video with a Filter on PC/iPhone/Android/Online?
- [Full Review] 240 FPS Video Definition/Samples/Cameras/Conversion
- How to Tag People in Google Photos Manually & Remove Tags?
- How to Transfer Photos from Camera to Computer Windows 11/10?
- Fix Adobe Media Encoder Error Code: -1609629695 and Similar Issue
User Comments :Post Comment