Ubuntu安裝QT Creator
一、從官網下載安裝包
QT官網
利用wget下載清華鏡像的qtcreator。
wget http://mirrors.tuna.tsinghua.edu.cn/qt/official_releases/qtcreator/4.14/4.14.2/qt-creator-opensource-linux-x86_64-4.14.2.run
此處不建議使用curl進行下載,可能會出現文件不完整的情況。
如果下載的run文件無法執行,確認一下文件大小是否在214.6 MB左右。如果文件偏小,可能是下載失敗。
二、修改下載文件的運行權限
chmod 744 qt-creator-opensource-linux-x86_64-4.14.2.run
三、執行
./qt-creator-opensource-linux-x86_64-4.14.2.run
此時會運行一個QT的安裝界面,輸入QT賬號,確認安裝目錄。
四、如果遇到運行失敗
如果在運行時,遇到下面的問題。可能是缺少庫導致的。
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
調查問題原因:
- 在~/.bashrc中添加
export QT_DEBUG_PLUGINS=1 - 執行
source ~/.bashrc - 重新運行
./qtcreator,得到下面的信息。
Cannot load library /home/leon/bin/qtcreator-4.14.2/lib/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/leon/bin/qtcreator-4.14.2/lib/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /home/leon/bin/qtcreator-4.14.2/lib/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)"
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
- 根據上面的提示信息,是
libqxcb.so出現了問題。 - 執行
libqxcb.so,獲得lib庫的詳細信息。得到下面的信息。
libxcb-xinerama.so.0 => not found
- 原因是libxcb-xinerama未找到導致的問題。執行
sudo apt install libxcb-xinerama0。問題成功解決。
五、效果展示

