Python——Reflex安装

Reflex 是一个开源框架,用于在纯 Python 中快速构建美观的交互式 Web 应用程序。

安装环境:

  • Ubuntu 23.04(完成软件更新)

安装虚拟环境

sudo apt-get install python3-venv

创建项目

mkdir my_app_name
cd my_app_name

 进入虚拟环境

python3 -m venv .venv
source .venv/bin/activate

创建reflex

pip install reflex

初始化reflex

reflex init
#这里可能会出现各种错误
#可能缺curl:sudo apt-get install curl
#如果出错,可以使用下面的进行debug操作,看一下具体哪里问题。一般都是没有下载成功什么东西。可以手动下载,放到指定位置上。
reflex init --loglevel debug


'''
Initializing the web directory.

Get started with a template:
(0) blank (https://blank-template.reflex.run) - A minimal template
(1) dashboard (https://dashboard.reflex.run) - A dashboard with tables and graphs
(2) chat (https://chat.reflex.run) - A ChatGPT clone
(3) sidebar (https://sidebar-template.reflex.run) - A template with a sidebar to navigate pages
Which template would you like to use? (0): 
'''
#如果顺利会将看到这个界面,默认是0,可以选择1

reflex run

reflex run
#运行reflex

 

 

重启后,需要重新运行。

 

posted @ 2024-04-23 15:11  新兵蛋Z  阅读(1248)  评论(0)    收藏  举报