Skip to content

whyboris/Intro-to-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome

This is a repository to help you get started with Python.

Quick start

On a Mac you already have Python 2 installed python --version in terminal will show you. We want Python 3 or later. Once installed python3 --version will confirm you have it once you have it installed.

Install requirements:

  1. Install git
  2. Install Python 3.6+
    • this will automatically install pip (Pip Installs Python - a way to download packages)
  3. Install virtualenv
    • open your terminal and run the command pip3 install virtualenv

Rather than install python packages (libraries) globally, we'll use virtual environments:

  1. Create a folder, go to it in your terminal
  2. virtualenv venv ('venv' or 'env' is a convention, you can use whatever word)
  3. source venv/bin/activate (you're now activating the virtual environment)

This is equivalent to node_modules 😎 -- run which python and you'll see the path points to inside your new folder. Now any time you pip instal [anything] it will be installed inside the virutal environemnt (inside the folder). To deactivate the environment, just enter deactivate in the terminal.

Jupyter

It's common to use Jupyter to play with data, share or explain a procedure, or even to run your company.

While inside the virtual environment, install with pip install jupyterlab or, as a common convention, by using the requirements.txt file with

pip install -r requirements.txt

Now start Jupyter Lab in your terminal with jupyter lab and open the showcase.ipynb from within Jupyter Lab 🎉

Pro tip

In your .bashrc (or .zshrc if you're on zsh, or the equivalent file you use with your terminal), add the alias:

alias py='python3'

You can also create a favorite environment in some convenient folder that you activate with some command, e.g.:

alias popo='source ~/.popo/venv/bin/activate'

About

A short introduction to Python - how to get started & some tools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors