在Ubuntu系统下搭建Python环境可以通过多种方式实现,以下是几种常见的方法:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
# 添加了conda export PATH="$HOME/miniconda3/bin:$PATH"
保存并退出编辑器。
更新Shell配置:
source ~/.bashrc
conda create --name myenv python=3.8
conda activate myenv
wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
bash Anaconda3-2024.02-1-Linux-x86_64.sh
按照提示完成安装。
验证安装:
conda -V
sudo apt update
sudo apt install python3 python3-pip
python3 --version
pip3 --version
python3 -m venv myenv
source myenv/bin/activate
pip install library_name
deactivate
以上方法都可以在Ubuntu系统下搭建Python环境,选择哪种方法取决于你的具体需求和偏好。