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

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

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

發(fā)布時間:2023/2/7 13:26:05

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

Pyramid 是一個小型、快速、實際的python web框架。那么在ubuntu18.04中如何安裝Pyramid呢?本文給出詳細說明。

1.首先確認安裝了python3

Ubuntu18.04系統(tǒng)如何安裝Pyramid-1381

說明:一般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

Ubuntu18.04系統(tǒng)如何安裝Pyramid-1382

3.安裝python3-pip

sudo apt install python3-pip

Ubuntu18.04系統(tǒng)如何安裝Pyramid-1383

4.安裝requests庫

sudo pip3 install Pyramid

Ubuntu18.04系統(tǒng)如何安裝Pyramid-1384

5.編寫測試程序

vi hello.py

寫入以下內容

from wsgiref.simple_server import make_server

from pyramid.config import Configurator

from pyramid.response import Response

def hello_world(request):

return Response('hello world')

if __name__ == '__main__':

with Configurator() as config:

config.add_route('hello','/')

config.add_view(hello_world,route_name='hello')

app = config.make_wsgi_app()

server = make_server('0.0.0.0',6543,app)

server.serve_forever()

保存退出

6.測試

python3 hello.py

在瀏覽器訪問ip:6543

Ubuntu18.04系統(tǒng)如何安裝Pyramid-1385

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