跳转至

1.5 Ubuntu22.04安装PySide6、pygame和tensorflow

约 295 个字 202 行代码 预计阅读时间 4 分钟

一、安装pip

在终端中,执行如下命令:

sudo apt install python3-pip

点击查看执行示例
执行示例.log
fotianmoyin@fotianmoyin-vm:~$ sudo apt install python3-pip
[sudo] fotianmoyin 的密码: 
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
将会同时安装下列软件:
  python3-wheel
下列【新】软件包将被安装:
  python3-pip python3-wheel
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 5 个软件包未被升级。
需要下载 1,337 kB 的归档。
解压缩后会消耗 7,178 kB 的额外空间。
您希望继续执行吗? [Y/n] Y
忽略:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/universe amd64 python3-wheel all 0.37.1-2ubuntu0.22.04.1
获取:2 http://cn.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 python3-pip all 22.0.2+dfsg-1ubuntu0.4 [1,305 kB]
获取:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/universe amd64 python3-wheel all 0.37.1-2ubuntu0.22.04.1 [32.0 kB]
已下载 1,337 kB,耗时 42秒 (32.1 kB/s)
正在选中未选择的软件包 python3-wheel。
(正在读取数据库 ... 系统当前共安装有 290605 个文件和目录。)
准备解压 .../python3-wheel_0.37.1-2ubuntu0.22.04.1_all.deb  ...
正在解压 python3-wheel (0.37.1-2ubuntu0.22.04.1) ...
正在选中未选择的软件包 python3-pip。
准备解压 .../python3-pip_22.0.2+dfsg-1ubuntu0.4_all.deb  ...
正在解压 python3-pip (22.0.2+dfsg-1ubuntu0.4) ...
正在设置 python3-wheel (0.37.1-2ubuntu0.22.04.1) ...
正在设置 python3-pip (22.0.2+dfsg-1ubuntu0.4) ...
正在处理用于 man-db (2.10.2-1) 的触发器 ...

二、安装PySide6

在终端中,执行如下代码:

pip install -i https://pypi.doubanio.com/simple pyside6

点击查看执行示例
执行示例.log
fotianmoyin@fotianmoyin-vm:~$ pip install -i https://pypi.doubanio.com/simple pyside6
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.doubanio.com/simple
Collecting pyside6
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/24/3a/a970808004b16dabdfaf77fa602b43a85c4d8812709a8bae065577283c4c/PySide6-6.6.1-cp38-abi3-manylinux_2_28_x86_64.whl (77 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.9/77.9 KB 4.7 MB/s eta 0:00:00
Collecting shiboken6==6.6.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/bb/72/e54f758e49e8da0dcd9490d006c41a814b0e56898ce4ca054d60cdba97bd/shiboken6-6.6.1-cp38-abi3-manylinux_2_28_x86_64.whl (245 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 245.2/245.2 KB 5.4 MB/s eta 0:00:00
Collecting PySide6-Addons==6.6.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/ec/b8/1f5335580241c3863584173308c842ffc74e05074f3f72b49e5b54ca18e3/PySide6_Addons-6.6.1-cp38-abi3-manylinux_2_28_x86_64.whl (125.2 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.2/125.2 MB 6.4 MB/s eta 0:00:00
Collecting PySide6-Essentials==6.6.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/56/65/50d0ced768b717f709a5ab224b648eb533a862efd0cde67d19c2727200b0/PySide6_Essentials-6.6.1-cp38-abi3-manylinux_2_28_x86_64.whl (82.3 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.3/82.3 MB 8.7 MB/s eta 0:00:00
Installing collected packages: shiboken6, PySide6-Essentials, PySide6-Addons, pyside6
  WARNING: The scripts pyside6-android-deploy, pyside6-assistant, pyside6-deploy, pyside6-designer, pyside6-genpyi, pyside6-linguist, pyside6-lrelease, pyside6-lupdate, pyside6-metaobjectdump, pyside6-project, pyside6-qml, pyside6-qmlcachegen, pyside6-qmlformat, pyside6-qmlimportscanner, pyside6-qmllint, pyside6-qmlls, pyside6-qmltyperegistrar, pyside6-qtpy2cpp, pyside6-rcc and pyside6-uic are installed in '/home/fotianmoyin/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed PySide6-Addons-6.6.1 PySide6-Essentials-6.6.1 pyside6-6.6.1 shiboken6-6.6.1

三、安装libxcb-xinerama0

在终端中,执行如下代码:

sudo apt install --reinstall libxcb-xinerama0

点击查看执行示例
执行示例.log
fotianmoyin@fotianmoyin-vm:~$ sudo apt install --reinstall libxcb-xinerama0
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
升级了 0 个软件包,新安装了 0 个软件包,重新安装了 1 个软件包,要卸载 0 个软件包,有 5 个软件包未被升级。
需要下载 5,414 B 的归档。
解压缩后会消耗 0 B 的额外空间。
获取:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/main amd64 libxcb-xinerama0 amd64 1.14-3ubuntu3 [5,414 B]
已下载 5,414 B,耗时 21秒 (261 B/s)           
(正在读取数据库 ... 系统当前共安装有 291319 个文件和目录。)
准备解压 .../libxcb-xinerama0_1.14-3ubuntu3_amd64.deb  ...
正在解压 libxcb-xinerama0:amd64 (1.14-3ubuntu3) 并覆盖 (1.14-3ubuntu3) ...
正在设置 libxcb-xinerama0:amd64 (1.14-3ubuntu3) ...
正在处理用于 libc-bin (2.35-0ubuntu3.6) 的触发器 ...

四、测试示例

在终端中,执行如下代码:

gedit hello.py
将下面的代码拷贝进去,然后保存
import sys
from PySide6.QtWidgets import QApplication, QLabel

app = QApplication(sys.argv)
label = QLabel("Hello World!")
label.show()
app.exec()
在终端中,执行如下代码,运行测试程序:
python3 hello.py
pyside_test

五、安装pygame

检查系统中是否安装pygame,可以使用如下代码:

pip show pygame

执行示例.log
fotianmoyin@fotianmoyin-vm:~$ pip show pygame
WARNING: Package(s) not found: pygame
安装pygame可以在终端中,执行如下代码:
pip install -i https://pypi.doubanio.com/simple pygame

点击查看执行示例
执行示例.log
fotianmoyin@fotianmoyin-vm:~$ pip install -i https://pypi.doubanio.com/simple pygame
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.doubanio.com/simple
Collecting pygame
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/c8/c7/0d77e0e327bf09c12f445f92f5bad0b447375d7b836c5bac5255ead8436f/pygame-2.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.0 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.0/14.0 MB 1.5 MB/s eta 0:00:00
Installing collected packages: pygame
Successfully installed pygame-2.5.2

六、安装tensorflow

我们这里是在虚拟机中安装tensorflow,所以独立显卡是用不上的。我们就安装cpu版本就行。在终端中,执行如下代码:

pip install -i https://pypi.doubanio.com/simple tensorflow==2.12.*

点击查看执行示例
执行示例.log
fotianmoyin@fotianmoyin-vm:~$ pip install -i https://pypi.doubanio.com/simple tensorflow==2.12.*
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.doubanio.com/simple
Collecting tensorflow==2.12.*
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/5a/eb/912d970b667fa8884199eb7cc2c351b86f8c73ea3d57a161ea91547c5d3b/tensorflow-2.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (585.9 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 585.9/585.9 MB 500.2 kB/s eta 0:00:00
Requirement already satisfied: setuptools in ./.local/lib/python3.10/site-packages (from tensorflow==2.12.*) (58.2.0)
Collecting astunparse>=1.6.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: six>=1.12.0 in /usr/lib/python3/dist-packages (from tensorflow==2.12.*) (1.16.0)
Collecting keras<2.13,>=2.12.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/d5/80/34e55d7e3ed9cf18020929460f969de1bf82cf2f509c639b358ae2b25618/keras-2.12.0-py2.py3-none-any.whl (1.7 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 13.8 MB/s eta 0:00:00
Collecting libclang>=13.0.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/ea/df/55525e489c43f9dbb6c8ea27d8a567b3dcd18a22f3c45483055f5ca6611d/libclang-16.0.6-py2.py3-none-manylinux2010_x86_64.whl (22.9 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 22.9/22.9 MB 12.6 MB/s eta 0:00:00
Collecting wrapt<1.15,>=1.11.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/fd/70/8a133c88a394394dd57159083b86a564247399440b63f2da0ad727593570/wrapt-1.14.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (77 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.9/77.9 KB 13.5 MB/s eta 0:00:00
Collecting typing-extensions<4.6.0,>=3.6.6
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/31/25/5abcd82372d3d4a3932e1fa8c3dbf9efac10cc7c0d16e78467460571b404/typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Collecting jax>=0.3.15
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/28/d0/edf653ea02628f2130ea2557f96d02b264768a2f54d22a9c002c7119cb1d/jax-0.4.23-py3-none-any.whl (1.7 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 14.8 MB/s eta 0:00:00
Collecting google-pasta>=0.1.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/a3/de/c648ef6835192e6e2cc03f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl (57 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.5/57.5 KB 14.1 MB/s eta 0:00:00
Collecting tensorflow-estimator<2.13,>=2.12.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/d1/e1/c3596da404e2c47561a2bb392397208925e65be6f61bd3081e630371d5e8/tensorflow_estimator-2.12.0-py2.py3-none-any.whl (440 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 440.7/440.7 KB 10.9 MB/s eta 0:00:00
Collecting tensorflow-io-gcs-filesystem>=0.23.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/41/2d/371c2f839cce26c9737a1b04ee28b2edbb8210f8ab743311b881ceb1005c/tensorflow_io_gcs_filesystem-0.35.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 15.4 MB/s eta 0:00:00
Collecting grpcio<2.0,>=1.24.3
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/ed/bd/4dbe2ae13ffba7eef2a3bd2dcebbc2255da18d1a972a89952d55e8ad3d4b/grpcio-1.60.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.4/5.4 MB 11.8 MB/s eta 0:00:00
Collecting h5py>=2.9.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/3b/d3/ecb4b3d2ec2c84132987e5f12ab1408f455bec1d90cd5bc408ebf37800f5/h5py-3.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 10.3 MB/s eta 0:00:00
Requirement already satisfied: packaging in /usr/lib/python3/dist-packages (from tensorflow==2.12.*) (21.3)
Collecting numpy<=1.24.3,>=1.22
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/6f/72/38f9a536bdb5bfb1682f2520f133ec6e08dde8bcca1f632e347641d90763/numpy-1.24.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.3/17.3 MB 12.5 MB/s eta 0:00:00
Collecting gast<=0.4.0,>=0.2.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/b6/48/583c032b79ae5b3daa02225a675aeb673e58d2cb698e78510feceb11958c/gast-0.4.0-py3-none-any.whl (9.8 kB)
Collecting absl-py>=1.0.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/a2/ad/e0d3c824784ff121c03cc031f944bc7e139a8f1870ffd2845cc2dd76f6c4/absl_py-2.1.0-py3-none-any.whl (133 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.7/133.7 KB 23.3 MB/s eta 0:00:00
Collecting tensorboard<2.13,>=2.12
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/32/09/86e2ef3b4f4ec04bde0eca499325f291ae6b3313381d0666ee20b5b80c73/tensorboard-2.12.3-py3-none-any.whl (5.6 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.6/5.6 MB 17.9 MB/s eta 0:00:00
Collecting protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/81/9e/63501b8d5b4e40c7260049836bd15ec3270c936e83bc57b85e4603cc212c/protobuf-4.25.2-cp37-abi3-manylinux2014_x86_64.whl (294 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 294.6/294.6 KB 42.5 MB/s eta 0:00:00
Collecting flatbuffers>=2.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/6f/12/d5c79ee252793ffe845d58a913197bfa02ae9a0b5c9bc3dc4b58d477b9e7/flatbuffers-23.5.26-py2.py3-none-any.whl (26 kB)
Collecting termcolor>=1.1.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/d9/5f/8c716e47b3a50cbd7c146f45881e11d9414def768b7cd9c5e6650ec2a80a/termcolor-2.4.0-py3-none-any.whl (7.7 kB)
Collecting opt-einsum>=2.3.2
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/bc/19/404708a7e54ad2798907210462fd950c3442ea51acc8790f3da48d2bee8b/opt_einsum-3.3.0-py3-none-any.whl (65 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 KB 14.5 MB/s eta 0:00:00
Requirement already satisfied: wheel<1.0,>=0.23.0 in /usr/lib/python3/dist-packages (from astunparse>=1.6.0->tensorflow==2.12.*) (0.37.1)
Collecting ml-dtypes>=0.2.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/71/01/7dc0e2cdead686a758810d08fd4111602088fe3f0d88064a83cbfb635593/ml_dtypes-0.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 1.1 MB/s eta 0:00:00
Collecting scipy>=1.9
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/f5/aa/8e6071a5e4dca4ec68b5b22e4991ee74c59c5d372112b9c236ec1faff57d/scipy-1.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (38.4 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.4/38.4 MB 1.2 MB/s eta 0:00:00
Collecting google-auth<3,>=1.6.3
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/aa/42/c3873f5a4369d28eb0006bfc80837f28b18bd4e04526f55cc9c8eac7a803/google_auth-2.26.2-py2.py3-none-any.whl (186 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 186.5/186.5 KB 15.4 MB/s eta 0:00:00
Collecting tensorboard-data-server<0.8.0,>=0.7.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/73/c6/825dab04195756cf8ff2e12698f22513b3db2f64925bdd41671bfb33aaa5/tensorboard_data_server-0.7.2-py3-none-manylinux_2_31_x86_64.whl (6.6 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.6/6.6 MB 17.0 MB/s eta 0:00:00
Collecting markdown>=2.6.8
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/42/f4/f0031854de10a0bc7821ef9fca0b92ca0d7aa6fbfbf504c5473ba825e49c/Markdown-3.5.2-py3-none-any.whl (103 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.9/103.9 KB 14.1 MB/s eta 0:00:00
Collecting werkzeug>=1.0.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/c3/fc/254c3e9b5feb89ff5b9076a23218dafbc99c96ac5941e900b71206e6313b/werkzeug-3.0.1-py3-none-any.whl (226 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 226.7/226.7 KB 42.0 MB/s eta 0:00:00
Collecting google-auth-oauthlib<1.1,>=0.5
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/4a/07/8d9a8186e6768b55dfffeb57c719bc03770cf8a970a074616ae6f9e26a57/google_auth_oauthlib-1.0.0-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: requests<3,>=2.21.0 in /usr/lib/python3/dist-packages (from tensorboard<2.13,>=2.12->tensorflow==2.12.*) (2.25.1)
Collecting pyasn1-modules>=0.2.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/cd/8e/bea464350e1b8c6ed0da3a312659cb648804a08af6cacc6435867f74f8bd/pyasn1_modules-0.3.0-py2.py3-none-any.whl (181 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 181.3/181.3 KB 33.6 MB/s eta 0:00:00
Collecting cachetools<6.0,>=2.0.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/a2/91/2d843adb9fbd911e0da45fbf6f18ca89d07a087c3daa23e955584f90ebf4/cachetools-5.3.2-py3-none-any.whl (9.3 kB)
Collecting rsa<5,>=3.1.4
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/49/97/fa78e3d2f65c02c8e1268b9aba606569fe97f6c8f7c2d74394553347c145/rsa-4.9-py3-none-any.whl (34 kB)
Collecting requests-oauthlib>=0.7.0
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/6f/bb/5deac77a9af870143c684ab46a7934038a53eb4aa975bc0687ed6ca2c610/requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting MarkupSafe>=2.1.1
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/36/2a/fab302636634e1f770a26aac212e44cff25522ed3c9189bd8afc9ae2effd/MarkupSafe-2.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting pyasn1<0.6.0,>=0.4.6
  Downloading https://mirrors.cloud.tencent.com/pypi/packages/d1/75/4686d2872bf2fc0b37917cbc8bbf0dd3a5cdb0990799be1b9cbf1e1eb733/pyasn1-0.5.1-py2.py3-none-any.whl (84 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 84.9/84.9 KB 18.6 MB/s eta 0:00:00
Requirement already satisfied: oauthlib>=3.0.0 in /usr/lib/python3/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<1.1,>=0.5->tensorboard<2.13,>=2.12->tensorflow==2.12.*) (3.2.0)
Installing collected packages: libclang, flatbuffers, wrapt, typing-extensions, termcolor, tensorflow-io-gcs-filesystem, tensorflow-estimator, tensorboard-data-server, requests-oauthlib, pyasn1, protobuf, numpy, MarkupSafe, markdown, keras, grpcio, google-pasta, gast, cachetools, astunparse, absl-py, werkzeug, scipy, rsa, pyasn1-modules, opt-einsum, ml-dtypes, h5py, jax, google-auth, google-auth-oauthlib, tensorboard, tensorflow
Successfully installed MarkupSafe-2.1.4 absl-py-2.1.0 astunparse-1.6.3 cachetools-5.3.2 flatbuffers-23.5.26 gast-0.4.0 google-auth-2.26.2 google-auth-oauthlib-1.0.0 google-pasta-0.2.0 grpcio-1.60.0 h5py-3.10.0 jax-0.4.23 keras-2.12.0 libclang-16.0.6 markdown-3.5.2 ml-dtypes-0.3.2 numpy-1.24.3 opt-einsum-3.3.0 protobuf-4.25.2 pyasn1-0.5.1 pyasn1-modules-0.3.0 requests-oauthlib-1.3.1 rsa-4.9 scipy-1.12.0 tensorboard-2.12.3 tensorboard-data-server-0.7.2 tensorflow-2.12.1 tensorflow-estimator-2.12.0 tensorflow-io-gcs-filesystem-0.35.0 termcolor-2.4.0 typing-extensions-4.5.0 werkzeug-3.0.1 wrapt-1.14.1

在python中测试一下,运行如下代码:

python3
import tensorflow as tf
tf.__version__

点击查看执行示例
执行示例.log
fotianmoyin@fotianmoyin-vm:~$ python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2024-01-21 11:22:22.402670: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2024-01-21 11:22:22.669631: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2024-01-21 11:22:22.670506: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-01-21 11:22:24.473901: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
>>> tf.__version__
'2.12.1'

打印出了tensorflow版本,测试成功 推出python交互界面,可以输入exit(),也可以按Ctrl+Z

至此,在Ubuntu22.04.3 中安装PySide6、pygame和tensorflow介绍完毕