ubuntu 安裝qt,配置環境變數

2021-09-25 08:21:04 字數 932 閱讀 2271

qt安裝後qmake命令還不能直接使用,需要將qt的bin目錄新增到path中:

第一種;新增到/etc/profile,這種方式作用於系統中的所有使用者

執行命令: vi /etc/profile,在末尾插入如下內容:

export qtdir=/opt/qt5.12.3/5.12.3

export path=$qtdir/gcc_64/bin:$path

export ld_library_path=$qtdir/gcc_64/lib

儲存退出後,重啟系統

第二種: vi /etc/bashrc 或 vi /etc/bash.bashrc,這種方式作用於每個使用bash的使用者,(不需要重啟系統,重新開啟乙個終端即可)

插入如下內容:

export qtdir=/opt/qt5.12.3/5.12.3

export path=$qtdir/gcc_64/bin:$path

export ld_library_path=$qtdir/gcc_64/lib

第三種: vi ~/.bash_profile 或 vi ~/.profile ,作用於當前使用者

插入如下內容:

export qtdir=/opt/qt5.12.3/5.12.3

export path=$qtdir/gcc_64/bin:$path

export ld_library_path=$qtdir/gcc_64/lib

需要重啟系統

第四種: vi ~/.bashrc ,作用於當前使用者,不需要重啟系統,新開啟乙個終端即可

插入如下內容:

export qtdir=/opt/qt5.12.3/5.12.3

export path=$qtdir/gcc_64/bin:$path

export ld_library_path=$qtdir/gcc_64/lib

Ubuntu安裝QT開發環境

雖然網路上很多人使用 redhat 或者fedora 作為上位機作業系統,但是我覺得使用ubuntu最為方便,因為需要的軟體包大部分都可以通過 apt get 方式來安裝,而不必從源 開始自己編譯。要知道,自己編譯源 可不是一件輕鬆的事,因為在編譯過程中經常會出現令人意外而且莫名其妙的錯誤。我們使用...

Ubuntu 安裝Qt開發環境

一 ubuntu下安裝qt sudo apt get install qt4 dev tools qt4 doc qt4 qtconfig qt4 demos qt4 designer 注 qt4 dev tools 包含了qt assistant及qt linguist等工具,因此不需要單獨安裝這...

ubuntu 安裝和配置 QT

install qt 5 on ubuntu qt wiki sudo gedit usr lib x86 64 linux gnu qtchooser default.conf sudo gedit usr lib x86 64 linux gnu qt default qtchooser def...