2
$ python text.py
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'C:\Program Files\Python38\python.exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = 'C:\\Program Files\\Python38\\python.exe
  sys.base_prefix = 'C:\\Program Files\\Python38
  sys.base_exec_prefix = 'C:\\Program Files\\Python38
  sys.executable = 'C:\\Program Files\\Python38\\python.exe
  sys.prefix = 'C:\\Program Files\\Python38
  sys.exec_prefix = 'C:\\Program Files\\Python38
  sys.path = [
    'C:\\Program Files\\Python38\\python38.zip',
    'C:\\Program Files\\Python38\\DLLs',
    'C:\\Program Files\\Python38\\lib',
    'C:\\Program Files\\Python38',
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: no codec search functions registered: can't find anything

Current thread 0x0000c158 (most recent call first):
<no Python frame>

I am currently getting back to learning python. At the moment I am using hyper terminal. For some reason when I do commands like "python (pythonFile.py)" it displays the error as shown above. I did python last year and stopped due to school. There are still python files in my laptop.

CATboardBETA
  • 418
  • 6
  • 29
  • Per the site rules, you must post errors as formatted text in your post, not as screenshots, and not in a comment. It will make your post searchable. Also, including the actual error message in your question title would really help, too. – Random Davis Jan 14 '21 at 23:57
  • Thanks !!. Been a while since I posted a qn. – Muhammad Nur Hazrul Jan 15 '21 at 00:02
  • [Py\_Initialize fails - unable to load the file system codec](https://stackoverflow.com/a/5694730) – 001 Jan 15 '21 at 00:02
  • I checked on other post and found out different version may use py instead of python. Using py worked for me to run python files. But i am still unable to run pip install and it still shows me the same error – Muhammad Nur Hazrul Jan 15 '21 at 00:33

1 Answers1

0

Fixed the problem for both running python file and using pip. Use py {yourPythonFile.py} to run the file instead of python (https://docs.python.org/3/faq/windows.html#how-do-i-run-a-python-program-under-windows). As for using pip, I could install it but cant import it . Went to change the pythonpath to the folder containing the pip folder (https://stackoverflow.com/a/56861629/10176299) make sure to check the pip documentation too (https://pip.pypa.io/en/stable/installing/) shows everything from installing to showing where the pip folder is.

{
    "python.pythonPath":         "C:\\Users\\hal19\\AppData\\Local\\Programs\\Python\\Python39\\Lib\\site-packages",
}