Windows下快速安裝Flask的一次經曆

來源:互聯網
上載者:User

標籤:成功   com   路徑   set   setup   tar.gz   測試   配置   python版本   

前提:

1.已安裝python版本(一般都是2.X)

2.已安裝easy_install

 

python安裝,記得配置Python的環境變數,例如:我的直接在Path上加 G:\Python

驗證安裝Python成功:cmd 輸入python 或者python -V

 

---------------------------------------------------------------------------------------------------------------------------------------------------

這是下載easy_install的網站
:http://pypi.python.org/pypi/setuptools 可以找到正確的版本進行下載。

win7 32位可以下載setuptools-0.6c11.win32-py2.7.exe 。

win7 64位必須使用ez_setup.py進行安裝。

以下是我64位的下載的

我這個的:

https://pypi.python.org/packages/ba/2c/743df41bd6b3298706dfe91b0c7ecdc47f2dc1a3104abeb6e9aa4a45fa5d/ez_setup-0.9.tar.gz

下載ez_setup.py後解壓,在cmd下進入剛才解壓的路徑,執行 python ez_setup.py,即可自動安裝。


安裝完easy_install後,在系統內容變數的PATH中添加easy_install所在的目錄,例如:G:\Python\Scripts

  1. 在cmd中輸入easy_install virtualenv ,安裝 virtualenv,這個主要是用來做解譯器環境隔離的
  2. 選擇一個盤配置虛擬環境,例如D盤
  3. cmd進入D盤,執行:virtualenv myvir  ,得到D盤中myvir虛擬環境檔案目錄
  4.  

  5. 然後cd到myvir目錄的Scripts下,輸入activate.bat

  6.  

  7. 然後輸入easy_install Flask
  8. 測試:hello.py 儲存在 D:\myvir\Scripts

  9. from flask import Flask  app=Flask(__name__)  @app.route(‘/‘)  def hello_world():      return "Hello World"  if __name__ == ‘__main__‘:      app.run()  

  10.  

    執行 python hello.py

  11.  

  12. 開啟網址 http://127.0.0.1:5000 ,成功安裝flask
  13.  

Windows下快速安裝Flask的一次經曆

相關文章

聯繫我們

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