0
点赞
收藏
分享

微信扫一扫

安装Streamlit到MAC OS备忘

Streamlit是一个开源库,可以帮助数据科学家和学者在短时间内开发机器学习 (ML) 可视化仪表板。只需几行代码,我们就可以构建并部署强大的数据应用程序。

为什么选择Streamlit?

目前,应用程序需求量巨大,开发人员需要一直开发新的库和框架,帮助构建并部署快速上手的仪表板。Streamlit 是一个库,可将仪表板的开发时间从几天缩短至几小时。以下是选择 Streamlit 的原因:

1. Streamlit是一个免费的开源库。

2. 和安装其他python 包一样, Streamlit的安装非常简单。

3. Streamlit学起来很容易,无需要任何 Web 开发经验,只需对 Python 有基本的了解,就足以构建数据应用程序。

4. Streamlit与大部分机器学习框架兼容,包括 Tensorflow 和 Pytorch、Scikit-learn 和可视化库,如 Seaborn、Altair、Plotly 等。

二、Install Pipenv

pip3 install pipenv

Copy

三、Create a new environment with Streamlit

此处内容是重点!

  1. Navigate to your project folder:

cd myproject

  1. CopyCreate a new Pipenv environment in that folder and activate that environment:

pipenv shell

When you run the command above, a file called ​Pipfile​​ will appear in ​​myprojects/​​. This file is where your Pipenv environment and its dependencies are declared.

  1. Install Streamlit in your environment:

pip install streamlit

CopyOr if you want to create an easily-reproducible environment, replace ​​pip​​​ with ​​pipenv​​ every time you install something:

pipenv install streamlit

这一步虽然安装的内容有点多,但是体积并不大,速度也非常快!

Copy

  1. Test that the installation worked:

streamlit hello

  1. Streamlit's Hello app should appear in a new tab in your web browser!

安装Streamlit到MAC OS备忘_应用程序


四、Use your new environment

  1. Any time you want to use the new environment, you first need to go to your project folder (where the​​Pipenv​​ file lives) and run:

pipenv shell

Copy

  1. Now you can use Python and Streamlit as usual:

streamlit run myfile.py

Copy

To stop the Streamlit server, press ​​ctrl-C​​.

  1. When you're done using this environment, just type​​exit​​​ or press​​ctrl-D​​ to return to your normal shell.

五、主要参考:

​​https://docs.streamlit.io/library/get-started/installation​​

举报

相关推荐

0 条评论