linux 安装 python3.10

apt update

apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git

wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz

tar xvf Python-3.10.0.tgz

cd Python-3.10.0

./configure --enable-optimizations

make -j$(nproc)
make altinstall

python3.10 --version

 

//切换默认python

update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1

update-alternatives --config python3

 

//激活虚拟环境

python3 -m venv myenv

source myenv/bin/activate

# 如果要退出虚拟换 

deactivate

 

pip install --upgrade pip

 

# 如果tb-nightly 安装不存在

pip install tb-nightly --index-url https://pypi.org/simple

posted on 2023-10-31 19:52  yaolunhui  阅读(780)  评论(0编辑  收藏  举报

导航