This is a repository to help you get started with Python.
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:
- Install git
- Install Python 3.6+
- this will automatically install pip (Pip Installs Python - a way to download packages)
- Install virtualenv
- open your terminal and run the command
pip3 install virtualenv
- open your terminal and run the command
Rather than install python packages (libraries) globally, we'll use virtual environments:
- Create a folder, go to it in your terminal
virtualenv venv('venv' or 'env' is a convention, you can use whatever word)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.
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.txtNow start Jupyter Lab in your terminal with jupyter lab and open the showcase.ipynb from within Jupyter Lab 🎉
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'