6
Ubuntu18.04从源代码安装Python3.9
source link: http://fancyerii.github.io/2024/02/02/build-py39-from-source/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Ubuntu18.04从源代码安装Python3.9
Posted by lili on February 2, 2024本文解释在Ubuntu18.04下从源代码build安装Python3.9的方法。
目录
Ubuntu18.04通过apt能够安装最新的python版本是3.8,但是我们有的时候需要更高版本的python,比如3.9。一种方法是通过conda安装,但是有的时候我们没有安装conda,那么我们可以通过源代码编译安装python(我们这里当然说的是cpython)。
sudo apt-get update
sudo apt-get install gdebi-core
sudo apt-get install \
curl \
gcc \
libbz2-dev \
libev-dev \
libffi-dev \
libgdbm-dev \
liblzma-dev \
libncurses-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
make \
tk-dev \
wget \
zlib1g-dev
还需要安装uuid-dev libgdbm-compat-dev,否则会出现:
sudo apt-get install uuid-dev libgdbm-compat-dev
The necessary bits to build these optional modules were not found:
_dbm _uuid
export PYTHON_VERSION=3.9.18
export PYTHON_MAJOR=3
curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
tar -xvzf Python-${PYTHON_VERSION}.tgz
cd Python-${PYTHON_VERSION}
build
./configure --enable-optimizations
make
sudo make install
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK