0% found this document useful (0 votes)
4 views3 pages

Streamlit Command Line Installation

Streamlit is a Python tool for building and sharing web apps, which requires proper setup using command line tools like venv and pip. The document outlines the steps to create a virtual environment, activate it, install Streamlit, create a simple app, and deactivate the environment. Following the routine of navigating to the project folder, activating the environment, and running the app ensures an organized and conflict-free development process.

Uploaded by

nawafabrar76
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Streamlit Command Line Installation

Streamlit is a Python tool for building and sharing web apps, which requires proper setup using command line tools like venv and pip. The document outlines the steps to create a virtual environment, activate it, install Streamlit, create a simple app, and deactivate the environment. Following the routine of navigating to the project folder, activating the environment, and running the app ensures an organized and conflict-free development process.

Uploaded by

nawafabrar76
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Installing Streamlit via Command

Line
What is Streamlit?
Streamlit is a Python tool that lets you build and share web apps easily. Before you can
use it, you need to set it up properly on your computer. The recommended way to do
this is through the command line using two built-in Python tools:
venv — for managing environments, and pip — for installing packages.

What is a Virtual Environment?


A virtual environment is like a separate, clean room for your project. When you install
Python packages for one project, they stay inside that room and don't affect other
projects. This prevents conflicts between different versions of packages. Think of it like
having separate toolboxes for different jobs so the tools don't get mixed up.

Step 1 – Create a Virtual Environment


First, open your terminal and go to your project folder. Then run this command to create
a virtual environment called .venv inside your project:
cd myproject
python -m venv .venv

This creates a folder named .venv where all your project's dependencies will live.

Step 2 – Activate the Environment


Before you can use the environment, you need to turn it on. The command depends on
your operating system:
# Windows Command Prompt
.venv\Scripts\[Link]

# Windows PowerShell
.venv\Scripts\Activate.ps1

# macOS and Linux


source .venv/bin/activate
Once activated, you will see (.venv) appear at the start of your terminal line. That
means the environment is now active and ready.

Step 3 – Install Streamlit


Now install Streamlit inside your active environment using pip:
pip install streamlit

To confirm it installed correctly, run the built-in demo app:


streamlit hello
A demo page should open automatically in your browser. If it doesn't, try the alternative
command:
python -m streamlit hello

Step 4 – Create and Run Your First App


Create a file called [Link] in your project folder and write this simple code inside it:
import streamlit as st

[Link]("Hello world")

Then run it from your terminal with:


streamlit run [Link]
Your browser will open a page displaying "Hello world" — your first Streamlit app is live!

Step 5 – Stop and Deactivate


When you're done, press Ctrl+C in the terminal to stop the server. To exit the virtual
environment and return to your normal terminal, type:
deactivate

Summary
Every time you work on this project, remember the routine:
1. Navigate to your project folder
2. Activate .venv
3. Run your app
This keeps everything organized, isolated, and working smoothly.

You might also like