ubuntu18.04安装Python3.7
时间: 2023-08-27 15:13:58 浏览: 190
精确制导武器-给ubuntu18安装python3.7的详细教程
回答: 在Ubuntu 18.04系统中安装Python 3.7可以按照以下步骤进行操作。首先,需要执行系统升级来确保系统是最新的版本。可以使用以下命令执行升级:
sudo apt update
sudo apt upgrade -y
接下来需要安装编译Python源程序所需的包。可以使用以下命令安装这些包:
sudo apt install build-essential -y
sudo apt install libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y
sudo apt-get install zlib1g-dev
然后,需要下载Python 3.7的源程序压缩包。可以使用wget命令下载:
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
接着,需要解压缩下载的压缩包。可以使用以下命令进行解压缩:
tar -xzvf Python-3.7.1.tgz
然后进入解压缩后的目录,并进行配置:
cd Python-3.7.1
./configure --enable-optimizations
配置完成后,可以使用make命令编译并安装Python 3.7:
make
sudo make install
最后,可以将python3指向Python 3.7版本。可以使用以下命令进行设置:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 1
这样,Python 3.7就安装完成了,并且python3命令将指向Python 3.7版本。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [ubuntu18.04安装python3.7并将python3指向python3.7](https://blog.csdn.net/yiyu3344/article/details/90102410)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [【Python】Ubuntu 18.04 安装 python3.7](https://blog.csdn.net/qq_35933777/article/details/84325856)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文