python3的virtualenvwrapper在linux下配置的執行個體

來源:互聯網
上載者:User
python版本管理&virtualenv管理

virtualenvwrapper是用來管理virtualenv的擴充包,用著很方便。

注意,在python3中,pip的安裝:sudo apt install python3-pip

    python2:sudo apt install python2-pip

1.virtualenvwrapper 安裝:

#安裝virtualenv(sudo) pip install virtualenv#安裝virtualenvwrapper(sudo) pip install virtualenvwrapper

2. 配置:

修改~/.bash_profile或其它環境變數相關檔案(如 .bashrc(我的Ubuntu15.10 下的是這個) 或用 ZSH 之後的 .zshrc),添加以下語句:

export WORKON_HOME=$HOME/.virtualenvsexport PROJECT_HOME=$HOME/workspacesource /usr/local/bin/virtualenvwrapper.sh

然後運行:

source ~/.bash_profile

3. 用法:

mkvirtualenv zqxt:建立運行環境zqxt

workon zqxt: 工作在 zqxt 環境 或 從其它環境切換到 zqxt 環境

deactivate: 退出終端環境

其它的:

rmvirtualenv ENV:刪除運行環境ENV

mkproject mic:建立mic項目和運行環境mic

mktmpenv:建立臨時運行環境

lsvirtualenv: 列出可用的運行環境

lssitepackages: 列出當前環境安裝了的包

註:也可直接使用 pyenv進行多版本python管理,內建virtualenv。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.