C
C
Coder 14482020-06-15 16:33:24
Python
Coder 1448, 2020-06-15 16:33:24

Why do .py files only run if you write python in front of them?

I write in the console: program_name.py. Gives out:

Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'C:\Users\\u0410\u0440\u0442\u0451\u043c\AppData\Local\Programs\Python\Python38\python.exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = 'C:\\Users\\\u0410\u0440\u0442\u0451\u043c\\AppData\\Local\\Programs\\Python\\Python38\\python.exe'
  sys.base_prefix = ''
  sys.base_exec_prefix = ''
  sys.executable = 'C:\\Users\\\u0410\u0440\u0442\u0451\u043c\\AppData\\Local\\Programs\\Python\\Python38\\python.exe'
  sys.prefix = ''
  sys.exec_prefix = ''
  sys.path = [
    'C:\\Users\\\u0410\u0440\u0442\u0451\u043c\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip',
    'C:\\Users\\\u0410\u0440\u0442\u0451\u043c\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\',
    'C:\\Users\\\u0410\u0440\u0442\u0451\u043c\\AppData\\Local\\Programs\\Python\\Python38\\DLLs\\',
    'C:\\Users\\\u0410\u0440\u0442\u0451\u043c\\AppData\\Local\\Programs\\Python\\Python38',
  ]
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 0x0000061c (most recent call first):
<no Python frame>


I write: python program_name.py. It gives out what is written in the program, everything works fine.
How to get rid of this need to constantly write python in the beginning?
PS Methods from stackoverflow didn't help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Coder 1448, 2020-06-17
@wows15

Solution: download the Uninstall tool crooked, delete everything and everywhere that is connected with the python. Install again without adding to PATH and without changing any settings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question