抱歉,您的浏览器无法访问本站

本页面需要浏览器支持(启用)JavaScript


了解详情 >

Virtualenvwrapper

Install

1
pip install virtualenvwrapper

Some environment variable

1
2
3
4
5
export WORKON_HOME=~/Envs  # specify home of venv

export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 # specify defaul python version

source /usr/local/bin/virtualenvwrapper.sh # active virtualenvwrapper when open terminal

Usage

  • New venv
    • mkvirtualenv your_venv_name --python=python_version
  • Active/Switch between venvs
    • workon your_venv_name
  • Quit
    • deactivate
  • Delete
    • rmvirtualenv your_venv_name
  • List All
    • lsvirtualenv
  • Hook
    • This hook is sourced after this virtualenv is activated
    • Specify in your_venv_home/your_venv_name/bin/postactive

Pipenv Usage

Install

1
pip install pipenv

Usage

Quick Start

1
2
3
4
5
6
cd     myproject
pipenv install # create virtual environment
pipenv install request # or install module
pipenv --venv # show location of this virtual environmenfuzzy findert
pipenv --py # show location of this python interpreter
pipenv shell # activate

Create a new project using Python 3.7, specifically

1
pipenv --python 3.7

Remove project virtualenv (inferred from current directory):

1
pipenv --rm

Install all dependencies for a project (including dev):

1
pipenv install --dev

Create a lockfile containing pre-releases:

1
pipenv lock --pre

Show a graph of your installed dependencies:

1
pipenv graph

Check your installed dependencies for security vulnerabilities:

1
pipenv check

Install a local setup.py into your virtual environment/Pipfile:

1
pipenv install -e .

Use a lower-level pip command:

1
pipenv run pip freeze

Activate

1
2
pipenv shell
python --version

Use pypi-mirror

1
pipenv install --pypi-mirror https://mirrors.aliyun.com/pypi/simple

OR edit Pipfile

1
2
3
4
5
[[source]]

url = "https://mirrors.aliyun.com/pypi/simple"
verify_ssl = true
name = "pypi"

评论