数据分析高数辅导李老师 發表於 2019-12-7 22:53:00

deepin下安装Qt5&以及部分问题解决

<h1 id="deepin安装qt5">deepin安装Qt5</h1>
<p><strong>1 deepin商店里的Qt5版本太低,可以直接下载官方的Qt5安装包:</strong></p>
<p>官方下载渠道:<code>http://www.qt.io/download-open-source/ </code></p>
<p>离线镜像下载渠道:<code>http://download.qt.io/official_releases/qt/</code>(推荐)</p>
<p><strong>2 下载完成,打开终端,输入命令:“sudo chmod -R 777 qt-opensource-linux-x64-5.13.2.run”,<em>(本人下载的是<code>qt-opensource-linux-x64-5.13.2.run</code>)</em>,赋予安装包权限</strong></p>
<p><strong>3 开始安装 Qt,输入命令“./qt-opensource-linux-x64-5.13.2.run”或者“sudo ./qt-opensource-linux-x64-5.13.2.run”</strong></p>
<blockquote>
<p><em>两者的区别在于,一个是将Qt默认安装在/home目录下,后者是将Qt安装在根目录/opt下,当然你也可以在图形界面安装过程中自行设置安装路径,但是建议最好不要</em></p>
</blockquote>
<p><strong>4 根据弹出的窗口,按照提示操作即可,要求填入账号哪里可以跳过或者注册一个登录都可以,组件哪里不知道选那些的建议全选,安装完成即可</strong></p>
<p><strong>5 Qt安装完成后,先别打开,因为还需要安装其他工具以及库文件:</strong></p>
<pre><code>   1|sudo apt-get install gcc g++         //安装 linux 下编程的编译器
   2|sudo apt-get install libqt4-dev      //不然编译时会出现错误“cannot find -lgl”
   3|sudo apt-get install build-essential //这是一个编译工具,它可以使得我们的程序知道头文件和库函数放在哪个位置;
</code></pre>
<p><strong>6 打开Qt创建项目即可</strong></p>
<h1 id="qt5安装后部分问题">Qt5安装后部分问题</h1>
<p><strong>1 构建项目就会出现:<code>-1: error: cannot find -lGL</code></strong></p>
<p><em><strong>解决方法:</strong></em><code>sudo apt-get install libgl1-mesa-dev</code></p>
<p><strong>2 安装Qt5后,重启deepin发现桌面黑屏了,但是终端和应用使用正常,只有桌面黑屏</strong></p>
<p><em><strong>解决方法:</strong></em></p>
<blockquote>
<p>部分人参考网上其他linux下的安装过程,发现有创建环境变量的步骤,如下:<br>
1 执行终端:<code>sudo gedit /etc/profile</code><br>
2 添加环境变量:</p>
</blockquote>
<pre><code>export QTDIR=/opt/Qt5.13.2/5.13.2
export PATH=$QTDIR/gcc_64/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/gcc_64/lib:$LD_LIBRARY_PATH
</code></pre>
<blockquote>
<p>3 生效环境变量:<code>source /etc/profile</code></p>
</blockquote>
<p>结果导致系统环境变量发生问题,删除添加环境变量即可</p>
<p>1.执行终端:<code>sudo gedit /etc/profile</code></p>
<p>2.删除环境变量</p>
<p>3.生效环境变量:<code>source /etc/profile</code></p>
<p>重启即可修复黑屏问题</p>
<p><em>此问题不知是deepin的BUG还是环境变量操作问题,具体原理我也不清楚,还请高人指点</em></p>


</div>
<div id="MySignature" role="contentinfo">
    If the heart is sunny, there is no sorrow.<br><br>
来源:https://www.cnblogs.com/hanlulu1998/p/12003845.html
頁: [1]
查看完整版本: deepin下安装Qt5&以及部分问题解决