您的位置:首页 > 文旅 > 旅游 > 网站建设和网页制作_大宗商品交易平台_百度推广开户需要多少钱_策划推广活动方案

网站建设和网页制作_大宗商品交易平台_百度推广开户需要多少钱_策划推广活动方案

2025/3/29 7:26:14 来源:https://blog.csdn.net/zlbdmm/article/details/142453343  浏览:    关键词:网站建设和网页制作_大宗商品交易平台_百度推广开户需要多少钱_策划推广活动方案
网站建设和网页制作_大宗商品交易平台_百度推广开户需要多少钱_策划推广活动方案

Ubuntu18升级cmake和python

  • 1、升级cmake至3.22.1
  • 2、升级python至3.8
    • 2.1 安装依赖包
    • 2.2 添加deadsnakes PPA源
    • 2.3 安装python3.8
    • 2.4 将python各版本添加到update-alternatives
    • 2.5 配置python3默认指向python3.8
    • 2.6 测试python3版本
    • 2.7 配置python默认指向python3
    • 2.8 测试python版本

1、升级cmake至3.22.1

某些软件包编译时需要高版本的Cmake,因此需要升级Cmake。 不能使用 sudo apt-get remove cmake卸载低版本cmake后再重装高版本,这样做会导致之前编译和安装的很多库一起被卸载!!!

正确步骤是:

1.1 去https://cmake.org/files下载所需版本的源码。也可以使用wget下载,例如:

cd /opt
wget https://cmake.org/files/v3.22/cmake-3.22.1.tar.gz

1.2 解压

tar -xzvf cmake-3.22.1.tar.gz

1.3 进入解压目录,配置成功之后显示:CMake has bootstrapped. Now run make.

chmod 777 ./configure
./configure

1.4 配置完成后,编译:

make

1.5 编译完成后,安装:

sudo make install

1.6 最后使用新安装的cmake替换旧版本,其中/usr/local/bin/cmake为新安装的cmake目录。

sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force

1.7 最后测试cmake版本:

cmake --version

1.8 原理

安装之前:
在这里插入图片描述
安装之后:
在这里插入图片描述

可以看到/usr/bin目录下的cmake成为了一个软链接,指向了/etc/alternatives/cmake,而后者由指向了/usr/local/bin/cmake,也就是我们安装的版本。其实就是通过软链接的方式将原始的程序“替换”了。

2、升级python至3.8

低版本的Ubuntu官方apt库中还未收录python3.10,这里使用deadsnakes PPA库安装。

2.1 安装依赖包

sudo apt update
sudo apt install software-properties-common

2.2 添加deadsnakes PPA源

sudo add-apt-repository ppa:deadsnakes/ppa

2.3 安装python3.8

sudo apt install python3.8python3.8 --version

2.4 将python各版本添加到update-alternatives

$ which python3.8
/usr/bin/python3.8$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1$ which python3.6
/usr/bin/python3.6$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

2.5 配置python3默认指向python3.8

$ sudo update-alternatives --config python3There are 2 choices for the alternative python3 (providing /usr/bin/python3).Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.6   2         auto mode1            /usr/bin/python3.6   2         manual mode2            /usr/bin/python3.8   1         manual modePress <enter> to keep the current choice[*], or type selection number: 2

2.6 测试python3版本

python3 --version

2.7 配置python默认指向python3

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 2$ sudo update-alternatives --config pythonThere are 2 choices for the alternative python (providing /usr/bin/python3).Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python2   2         auto mode1            /usr/bin/python2   2         manual mode2            /usr/bin/python3   1         manual modePress <enter> to keep the current choice[*], or type selection number: 2

2.8 测试python版本

python --version

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com