Ubuntu 20.04 configures qt environment variables

Ubuntu environment variable configuration file

System level:

  • /etc/environment: A system-wide environment variable configuration file, applicable to all users and processes. The environment variables set in this file will be shared by all users and processes. Since this file is system-wide, administrator privileges are required to modify it. After modifying this file, you need to log in again to make the set environment variables take effect.
  • /etc/profile: A system-wide shell profile that is read at login and executed when a login shell starts. Environment variables set in this file will be inherited by all logged in users. This file is typically used to set system-wide environment variables, such as variables such as PATH. .
  • /etc/bash.bashrc: System-wide Bash shell configuration file, including information such as environment variables and shell functions that need to be loaded when the Bash shell starts.

user level:

  • ~/.bashrc: The current user's Bash shell configuration file, which is executed on each new interactive Bash shell startup. Environment variables set in this file are only valid for the current user's Bash shell. This file is typically used to set the current user's Bash shell environment variables and personalization.
  • ~/.bash_profile: Bash shell profile for the current user, but it will only be executed when the first login shell starts. If this file exists, Bash will not execute the ~/.bashrc file. Environment variables set in this file will only be valid for the current user's login shell. This file is typically used to set the current user's login shell environment variables.
  • ~/.profile: The current user's shell configuration file, which will be read and executed at login. Environment variables set in this file will only be valid for the current user's login shell. This file is typically used to set the current user's login shell environment variables and personalization configuration.
  • ~/.pam_environment: PAM environment file, PAM (Pluggable Authentication Modules) is a system-level authentication framework, which provides a standardized interface that allows different authentication methods to interact in the system. Environment variables set in this file will be effective for the current user and all processes. This file is typically used to set user-level environment variables.

Why do I have to talk about this first, because these can help everyone better understand which file should be modified by the environment variable, and prevent "I have clearly set the environment variable, why didn't it take effect?" This kind of situation happens.

Detailed explanation of Qt environment variables

QTDIR: The root directory of Qt, which contains subdirectories such as bin, lib, include, and mkspecs.
PATH: Set the search path for Qt executable files, including Qt's bin directory and other related directories.
LD_LIBRARY_PATH: Set the search path of the Qt runtime library, including Qt's lib directory and other related directories.
QT_PLUGIN_PATH: Set the search path for Qt plugins, including Qt's plugins directory and other related directories.
QT_INCLUDE_PATH: Set the search path for Qt header files, including Qt's include directory and other related directories.
QT_LIBS: Sets a list of names of Qt libraries to use.
QMAKE: Specifies the path to the version of qmake to use, which is Qt's build system.
QMAKESPEC: Specifies the name of the mkspecs to use, used to specify the target platform and compiler options, etc.
QT_DEBUG: Set whether to enable Qt's debug mode.
QT_NO_DEBUG: Set whether to disable Qt's debug mode.
QT_BUILD_TREE: Specifies the root directory for Qt builds, which contains subdirectories such as src, mkspecs, and tools.
QT_INSTALL_PREFIX: Specify the installation directory of Qt.
QT_INSTALL_BIN: Specifies the installation directory of the Qt executable.
QT_INSTALL_LIBS: Specifies the installation directory of the Qt library files.
QT_INSTALL_HEADERS: Specifies the installation directory of the Qt header files.
QT_INSTALL_PLUGINS: Specifies the installation directory of the Qt plugin.

Set Qt environment variables

Through the above introduction, we are going to add the Qt environment variable to /etc/profile, and add the following values, the path needs to be based on your own actual situation.

sudo gedit /etc/profile

insert image description here

Finally restart just fine!

Guess you like

Origin blog.csdn.net/bmseven/article/details/129550228
Recommended