Ubuntu配置python和QT环境
qt各个版本官⽹下载地址
下⾯介绍在线命令⾏安装⽅法
1. 安装python
Ubuntu⾃带python,将版本改为python3即可,参考:
2. 安装QT
更新系统
$ sudo apt-get update
$ sudo apt-get upgrade
升级下pip⼯具
pip install --upgrade setuptools
python -m pip install --upgrade pip
使⽤pip安装 PyQt5
sudo pip3 install PyQt5
安装 Qt5 creator 和 designer
这⾥使⽤sudo apt-get install qtcreator安装时候报依赖错误,就偷懒使⽤了sudo aptitude install qtcreator解决依赖安装问题。
sudo apt-get install qtcreator
sudo apt-get install qt5-default qttools5-dev-tools
启动qt
$ designer
or
$ /usr/lib/x86_64-linux-gnu/qt5/bin/designer
linux操作记录
cds@cds-virtual-machine:~$ sudo pip3 install PyQt5
Collecting PyQt5
Downloading mirrors.aliyun/pypi/packages/4d/81/b9a66a28fb9a7bbeb60e266f06ebc4703e7e42b99e3609bf1b58ddd232b9/PyQt5-5.14.2.tar. gz (3.2MB)
100% |████████████████████████████████| 3.3MB 432kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in<module>
File "/usr/lib/python3.5/tokenize.py", line 454, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-5al708tc/PyQt5/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5al708tc/PyQt5/
cds@cds-virtual-machine:~$
cds@cds-virtual-machine:~$ sudo python -m pip install --upgrade --force pip
Collecting pip
Downloading mirrors.aliyun/pypi/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3 -none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 949kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed pip-20.0.2
cds@cds-virtual-machine:~$ pip install --upgrade setuptools
WARNING: The directory '/home/cds/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Ch eck the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: mirrors.aliyun/pypi/simple
Collecting setuptools
Downloading mirrors.aliyun/pypi/packages/a0/df/635cdb901ee4a8a42ec68e480c49f85f4c59e8816effbf57d9e6ee8b3588/setuptools-46.1.3-py 3-none-any.whl (582 kB)
|████████████████████████████████| 582 kB 4.6 MB/s
Installing collected packages: setuptools
Successfully installed setuptools-46.1.3
cds@cds-virtual-machine:~$ sudo pip3 install PyQt5
Looking in indexes: mirrors.aliyun/pypi/simple
Collecting PyQt5
Downloading mirrors.aliyun/pypi/packages/ce/18/81a91dab05831434d70a51bc5711fe83c4da5cc3bdbbfa798409ef3684c0/PyQt5-5.14.2-5.14.
2-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl (63.6 MB)
|████████████████████████████████| 63.6 MB 121 kB/s
Collecting PyQt5-sip<13,>=12.7
Downloading mirrors.aliyun/pypi/packages/f2/42/dc08148f08ad0f81f0f7b451ee8e94d721fc991536c6911a07ebc4e0c72f/PyQt5_sip-12.7.2-cp 35-cp35m-manylinux1_x86_64.whl (252 kB)
|████████████████████████████████| 252 kB 4.3 MB/s
Installing collected packages: PyQt5-sip, PyQt5
Successfully installed PyQt5-5.14.2 PyQt5-sip-12.7.2
cds@cds-virtual-machine:~$ sudo apt-get install qtcreator
Reading Done
Building dependency tree
Reading Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
qtcreator : Depends: libclang1-3.6 (>= 3.6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
cds@cds-virtual-machine:~$ sudo aptitude install qtcreator
The following NEW packages will be installed:
libbotan-1.10-1{a} libclang1-3.6{a} libllvm3.6v5{a} libobjc-5-dev{ab} libobjc4{ab} libqbscore1{a} libqbsqtprofilesetup1{a} libqt5clucene5{a} libqt5concurrent 5{a} libqt5designer5{a}
libqt5designercomponents5{a} libqt5help5{a} libqt5script5{a} libqt5xmlpatterns5{a} qml-module-qtquick-controls{a} qt5-qmake{a} qtbase5-dev-tools{a} qtc reator qtcreator-data{a} qtcreator-doc{a}
qttools5-dev-tools{a} qtxmlpatterns5-dev-tools{a}
0 packages upgraded, 22 newly installed, 0 to remove and 1 not upgraded.
Need to get 44.9 MB of archives. After unpacking 159 MB will be used.
The following packages have unmet dependencies:
libobjc4 : Depends: gcc-5-base (= 5.3.1-14ubuntu2) but 5.4.0-6ubuntu1~16.04.12 is installed.
libobjc-5-dev : Depends: gcc-5-base (= 5.3.1-14ubuntu2) but 5.4.0-6ubuntu1~16.04.12 is installed.
Depends: libgcc-5-dev (= 5.3.1-14ubuntu2) but 5.4.0-6ubuntu1~16.04.12 is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1)    libclang1-3.6 [Not Installed]
2)    libobjc-5-dev [Not Installed]
3)    libobjc4 [Not Installed]
4)    qtcreator [Not Installed]
Accept this solution? [Y/n/q/?] y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
cds@cds-virtual-machine:~$ sudo apt-get install qt5-default qttools5-dev-tools
Reading Done
Building dependency tree
Reading Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
qt5-default : Depends: qtbase5-dev
E: Unable to correct problems, you have held broken packages.ubuntu怎么安装python
cds@cds-virtual-machine:~$ sudo aptitude install qt5-default qttools5-dev-tools
The following NEW packages will be installed:
libdrm-dev{ab} libegl1-mesa-dev{ab} libgl1-mesa-dev{ab} libgles2-mesa{ab} libgles2-mesa-dev{a} libglu1-mesa-dev{a} libmirclient-dev{ab} libmircommon
-dev{a} libmircookie-dev{a} libmircookie2{a}
libprotobuf-dev{a} libqt5clucene5{a} libqt5concurrent5{a} libqt5designer5{a} libqt5designercomponents5{a} libqt5help5{a} libqt5opengl5-dev{ab} libwaylan d-dev{ab} libx11-xcb-dev{ab}
libxcb-dri2-0-dev{a} libxcb-dri3-dev{a} libxcb-glx0-dev{a} libxcb-present-dev{a} libxcb-randr0-dev{a} libxcb-render0-dev{a} libxcb-shape0-dev{a} libxcb-sy nc-dev{a} libxcb-xfixes0-dev{a}
libxdamage-dev{a} libxext-dev{a} libxfixes-dev{a} libxkbcommon-dev{ab} libxshmfence-dev{a} libxxf86vm-dev{a} mesa-common-dev{a} qt5-default qt5-q make{a} qtbase5-dev{ab} qtbase5-dev-tools{a}
qttools5-dev-tools x11proto-damage-dev{a} x11proto-dri2-dev{a} x11proto-fixes-dev{a} x11proto-gl-dev{a} x11proto-xext-dev{a} x11proto-xf86vidmode-d ev{a} zlib1g-dev{ab}
0 packages upgraded, 47 newly installed, 0 to remove and 1 not upgraded.
Need to get 11.2 MB of archives. After unpacking 53.8 MB will be used.
The following packages have unmet dependencies:
libgles2-mesa : Depends: libglapi-mesa (= 11.2.0-1ubuntu2) but 18.0.5-0ubuntu0~16.04.1 is installed.
libx11-xcb-dev : Depends: libx11-xcb1 (= 2:1.6.3-1ubuntu2) but 2:1.6.3-1ubuntu2.1 is installed.
libegl1-mesa-dev : Depends: libegl1-mesa (= 11.2.0-1ubuntu2) but 18.0.5-0ubuntu0~16.04.1 is installed.
Depends: libwayland-egl1-mesa (= 11.2.0-1ubuntu2) but 18.0.5-0ubuntu0~16.04.1 is installed.
libqt5opengl5-dev : Depends: libqt5opengl5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
libmirclient-dev : Depends: libmirclient9 (= 0.21.0+16.04.20160330-0ubuntu1) but 0.26.3+16.04.20170605-0ubuntu1.1 is installed.
libxkbcommon-dev : Depends: libxkbcommon0 (= 0.5.0-1ubuntu2) but 0.5.0-1ubuntu2.1 is installed.
zlib1g-dev : Depends: zlib1g (= 1:1.2.8.dfsg-2ubuntu4) but 1:1.2.8.dfsg-2ubuntu4.3 is installed.
libwayland-dev : Depends: libwayland-client0 (= 1.9.0-1) but 1.12.0-1~ubuntu16.04.3 is installed.
Depends: libwayland-server0 (= 1.9.0-1) but 1.12.0-1~ubuntu16.04.3 is installed.
Depends: libwayland-cursor0 (= 1.9.0-1) but 1.12.0-1~ubuntu16.04.3 is installed.
libgl1-mesa-dev : Depends: libgl1-mesa-glx (= 11.2.0-1ubuntu2) but 18.0.5-0ubuntu0~16.04.1 is installed.
qtbase5-dev : Depends: libqt5core5a (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
Depends: libqt5dbus5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
Depends: libqt5gui5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
Depends: libqt5network5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
Depends: libqt5printsupport5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
Depends: libqt5sql5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
Depends: libqt5test5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
Depends: libqt5widgets5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
Depends: libqt5xml5 (= 5.5.1+dfsg-16ubuntu7) but 5.5.1+dfsg-16ubuntu7.7 is installed.
libdrm-dev : Depends: libdrm2 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
Depends: libdrm-intel1 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
Depends: libdrm-radeon1 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
Depends: libdrm-nouveau2 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
Depends: libdrm-amdgpu1 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1)      libdrm-dev [Not Installed]
2)      libegl1-mesa-dev [Not Installed]
3)      libgl1-mesa-dev [Not Installed]
4)      libgles2-mesa [Not Installed]
5)      libgles2-mesa-dev [Not Installed]
6)      libglu1-mesa-dev [Not Installed]
7)      libmirclient-dev [Not Installed]
8)      libmircommon-dev [Not Installed]
9)      libprotobuf-dev [Not Installed]
10)    libqt5opengl5-dev [Not Installed]
11)    libwayland-dev [Not Installed]
12)    libx11-xcb-dev [Not Installed]
13)    libxkbcommon-dev [Not Installed]
14)    mesa-common-dev [Not Installed]
15)    qt5-default [Not Installed]
16)    qtbase5-dev [Not Installed]
17)    zlib1g-dev [Not Installed]
Accept this solution? [Y/n/q/?] y
The following NEW packages will be installed:
libqt5clucene5{a} libqt5designer5{a} libqt5designercomponents5{a} libqt5help5{a} qttools5-dev-tools
0 packages upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 5,468 kB of archives. After unpacking 15.4 MB will be used.
Need to get 5,468 kB of archives. After unpacking 15.4 MB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 mirrors.aliyun/ubuntu xenial/universe amd64 libqt5clucene5 amd64 5.5.1-3build1 [264 kB]
Get: 2 mirrors.aliyun/ubuntu xenial/universe amd64 libqt5designer5 amd64 5.5.1-3build1 [2,719 kB]
Get: 3 mirrors.aliyun/ubuntu xenial/universe amd64 libqt5designercomponents5 amd64 5.
5.1-3build1 [674 kB] Get: 4 mirrors.aliyun/ubuntu xenial/universe amd64 libqt5help5 amd64 5.5.1-3build1 [183 kB]
Get: 5 mirrors.aliyun/ubuntu xenial/universe amd64 qttools5-dev-tools amd64 5.5.1-3build1 [1,627 kB] Fetched 5,468 kB in 2s (2,612 kB/s)
Selecting previously unselected package libqt5clucene5:amd64.
(Reading database ... 237296 files and directories currently installed.)
Preparing to unpack .../libqt5clucene5_5.5.1-3build1_amd64.deb ...
Unpacking libqt5clucene5:amd64 (5.5.1-3build1)...
Selecting previously unselected package libqt5designer5:amd64.
Preparing to unpack .../libqt5designer5_5.5.1-3build1_amd64.deb ...
Unpacking libqt5designer5:amd64 (5.5.1-3build1)...
Selecting previously unselected package libqt5designercomponents5:amd64.
Preparing to unpack .../libqt5designercomponents5_5.5.1-3build1_amd64.deb ...
Unpacking libqt5designercomponents5:amd64 (5.5.1-3build1)...
Selecting previously unselected package libqt5help5:amd64.
Preparing to unpack .../libqt5help5_5.5.1-3build1_amd64.deb ...
Unpacking libqt5help5:amd64 (5.5.1-3build1)...
Selecting previously unselected package qttools5-dev-tools.
Preparing to unpack .../qttools5-dev-tools_5.5.1-3build1_amd64.deb ...
Unpacking qttools5-dev-tools (5.5.1-3build1)...
Processing triggers for libc-bin (2.23-0ubuntu11)...
Setting up libqt5clucene5:amd64 (5.5.1-3build1)...
Setting up libqt5designer5:amd64 (5.5.1-3build1)...
Setting up libqt5designercomponents5:amd64 (5.5.1-3build1)...
Setting up libqt5help5:amd64 (5.5.1-3build1)...
Setting up qttools5-dev-tools (5.5.1-3build1)...
Processing triggers for libc-bin (2.23-0ubuntu11)...

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。