Python 设置 virtual environment

  1. sudo apt update
  2. sudo apt -y install python3-venv
  3. python3 -m venv ~/venvs/dev
  4. source ~/venvs/dev/bin/activate
  5. # 如果要 deactivate
  6. deactivate

Pip3 相关设置

如果没有安装:

  1. sudo apt install python3-pip

阿里云镜像源

  1. mkdir -p ~/.pip
  2. vim ~/.pip/pip.conf

阿里云:

  1. [global]
  2. trusted-host = mirrors.aliyun.com
  3. index-url = https://mirrors.aliyun.com/pypi/simple

华为云:

  1. [global]
  2. index-url = http://mirrors.myhuaweicloud.com/pypi/web/simple
  3. format = columns
  4. [install]
  5. trusted-host=mirrors.myhuaweicloud.com

升级

  1. pip3 install --upgrade pip