Python Setup and Usage, Release 3.9.5 3.7 UTF-8 mode New in version 3.7. Windows still uses legacy encodings for the system encoding (the ANSI Code Page). Python uses it for the default encoding of text files (e.g. locale.getpreferredencoding() ). This may cause issues because UTF-8 is widely used on the internet and most Unix systems, including WSL (Windows Subsystem for Linux). You can use UTF-8 mode to change the default text encoding to UTF-8. You can enable UTF-8 mode via the -X utf8 command line option, or the PYTHONUTF8=1 environment variable. See PYTHONUTF8 for enabling UTF-8 mode, and Excursus: Setting environment variables for how to modify environment variables. When UTF-8 mode is enabled: Note that adding PYTHONUTF8=1 to the default environment variables will affect all Python 3.7+ applications on your system. If you have any Python 3.7+ applications which rely on the legacy system encoding, it is recommended to set the environment variable temporarily or use the$_{-X utf8}$ command line option. • locale.getpreferredencoding() returns 'UTF-8' instead of the system encoding. This function is used for the default text encoding in many places, including open() , Popen , Path.read_text() , etc. • sys.stdin , sys.stdout , and sys.stderr all use UTF-8 as their text encoding. • You can still use the system encoding via the “mbcs” codec. • Console I/O including standard I/O (see PEP 528 for details). • The filesystem encoding (see PEP 529 for details). Note: Even when UTF-8 mode is disabled, Python uses UTF-8 by default on Windows for: New in version 3.3. The Python launcher for Windows is a utility which aids in locating and executing of different Python versions. It allows scripts (or the command-line) to indicate a preference for a specific Python version, and will locate and execute that version. Unlike the$_{PATH}$ variable, the launcher will correctly select the most appropriate version of Python. It will prefer per- user installations over system-wide ones, and orders by language version rather than using the most recently installed version. The launcher was originally specified in PEP 397 . 3.8 Python Launcher for Windows 3.8.1 Getting started From the command-line Changed in version 3.6. System-wide installations of Python 3.3 and later will put the launcher on your$_{PATH}$ . The launcher is compatible with all available versions of Python, so it does not matter which version is installed. To check that the launcher is available, execute the following command in Command Prompt: py Chapter 3. Using Python on Windows 26