python Setting the Role and Instance of Environment Variables

  • 2021-07-13 05:30:21
  • OfStack

Environment Variables for Python

环境变量 说明
PYTHONSTARTUP 在交互式启动时执行的文件(无默认值)
PYTHONPATH ‘:' - 以默认模块搜索路径为前缀的分隔目录列表。结果是sys.path。
PYTHONHOME 交替的 <prefix> 目录 (或者 <prefix>:<exec_prefix>). 默认的模块搜索路径为 <prefix>/pythonX.X.
PYTHONCASEOK 忽略import语句中的大小写(Windows)。
PYTHONIOENCODING 用于 stdin/stdout/stderr 中的编码
PYTHONHASHSEED 如果此变量设置为random,则效果与-R选项相同:使用1个随机值为str,bytes和datetime对象的哈希值设定种子。它也可以设置为 [0, 4294967295] 范围内的整数,以获得具有可预测种子的哈希值。

Set the role of environment variables of Python:

When the system is required to run a program without telling it the full path of the program, the system should look for the program under the current directory and also go to the path specified in path. Users can run the process better by setting environment variables.

If you install Python without setting environment variables:

1. If the environment variable is not set, tapping python on the cmd command line will prompt that the python command cannot be found. 2. If you do not set the environment variable to install the third package of Python, you will be prompted that the corresponding python version path cannot be found. 3. If you don't set the environment variable, you can't find the path when installing the package with pip install.

Environment variables:

Environment variables (environment variables) 1 generally refer to 1 parameters used in the operating system to specify the operating environment of the operating system, such as: temporary folder location and system folder location, etc.

An environment variable is an object with a specific name in the operating system that contains information that will be used by one or more applications.


Related articles: