在 Ubuntu 中 安裝python 開發環境( virtualenv 和 virtualenvwrapper)

來源:互聯網
上載者:User

標籤:virtualenv   virtualenvwrapper   

virtualenv: linux 的一個虛擬環境

virtualenvwrapper: 基於 virtualenv 之上的一個工具,通過它可以方便的建立/啟用/管理/銷毀虛擬環境,沒它的話進行上面的操作將會相當麻煩。

安裝 python3

sudo apt-get install python3

sudo apt-get install python-setuptools


安裝 pip

sudo apt-get install pip


安裝virtualenv和virtualenvwrapper

$sudo apt-get install python-virtualenv

$sudo easy_install virtualenvwrapper


1.建立目錄用來存放虛擬環境

    mkdir $HOME/.virtualenvs

2.在~/.bashrc中添加行:

    export WORKON_HOME=$HOME/.virtualenvs

    source /usr/local/bin/virtualenvwrapper.sh

3.運行:

    source ~/.bashrc

3.建立python虛擬環境

mkvirtualenv [虛擬環境名稱]

4.切換虛擬環境

workon [虛擬環境名稱]

5.退出虛擬環境

     deactivate

6.刪除虛擬環境

     rmvirtualenv [虛擬環境名稱]


註:建立的環境是獨立的,互不干擾,無需sudo許可權即可使用 pip 來進行包的管理,如果在虛擬環境中使用sudo安裝的包在主環境中


使用-p參數指定虛擬環境中python的版本

$ mkvirtualenv -p python django



安裝redis,在Ubuntu中執行下面這句命令:

$sudo apt-get install redis-server

啟動服務端

$redis-server

啟動用戶端

$redis-cli



瀏覽器緩衝

Ctrl+Shift+Del  清除Google瀏覽器緩衝的快速鍵

Ctrl+Shift+R  重新載入當前網頁而不使用緩衝內容



本文出自 “騎豬去旅行” 部落格,請務必保留此出處http://songqinglong.blog.51cto.com/7591177/1934889

在 Ubuntu 中 安裝python 開發環境( virtualenv 和 virtualenvwrapper)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.