国产午夜视频在线观看,国产国拍精品av在线观看,国产国产人免费人成免费视频,国产福利视频一区二区在线,国产av免费一区二区三区

廈門服務(wù)器租用>動態(tài)撥號VPS>Ubuntu18.04系統(tǒng)如何安裝sanic

Ubuntu18.04系統(tǒng)如何安裝sanic

發(fā)布時間:2023/1/31 11:39:00

Ubuntu18.04系統(tǒng)如何安裝sanic

Sanic 是一個類Flask 的基于Python3.5 的web框架,它編寫的代碼速度特別快。那么在ubuntu18.04中如何安裝sanic呢?本文給出詳細說明。

1.首先確認安裝了python3

Ubuntu18.04系統(tǒng)如何安裝sanic-1311

說明:一般linux系統(tǒng)默認都有安裝python環(huán)境,包括python2和python3,在命令行中python默認指的是python2。python2已經(jīng)接近淘汰,但由于linux系統(tǒng)環(huán)境中還有大量基于python2的軟件,因此在linux系統(tǒng)中還保留著python2。目前推薦使用python3。

2.更新軟件列表

sudo apt-get update

3.安裝python3-pip

sudo apt-get install python3-pip

4.安裝flask

sudo pip3 install sanic

5.創(chuàng)建一個sanic程序

vi hello.py

在其中寫入

from sanic import Sanic

from sanic.response import text

app = Sanic(__name__)

@app.route('/')

async def hello_world(request):

return text('hello,world')

app.run(host="0.0.0.0", port=8000, debug=True)

保存退出

6.運行hello.py

python3 hello.py

Ubuntu18.04系統(tǒng)如何安裝sanic-1312

7.測試

在瀏覽器打開主機IP:8000

Ubuntu18.04系統(tǒng)如何安裝sanic-1313

安裝成功


在線客服
微信公眾號
免費撥打400-1886560
免費撥打0592-5580190 免費撥打 400-1886560 或 0592-5580190
返回頂部
返回頭部 返回頂部