«

Setting up Python

We recommend using a Python virtualenv for any Python-based analytics tools. Python 3 ships with virtualenv by default, however, if it is missing in your environment you can install it with your package manager or using pip:

pip3 install virtualenv

Setting up a Python virtual environment

  1. Create a new empty directory for your Python environment and cd into it:
mkdir my-python-env
cd my-python-env
  1. If you do not yet have it, install Python 3 locally:
brew install python3
  1. Set up a Python virtual environment:

This step is only required once when you first create the virtual environment. If you have multiple versions of Python 3+ installed, you will need to use version 3.6 or greater for the following command (i.e. python3.7 instead of python3).

python3 -m venv venv
  1. To start the virtual environment, run:
. venv/bin/activate
  1. A (venv) will be displayed at the front of your terminal prompt. This lets you know that you're using this virtual environment.
  2. Now update Python tools and install the libraries used by the

various Python tools:

pip install --upgrade setuptools pip
pip install pandas==0.23.4
pip install sqlalchemy==1.2.18
pip install pyhive[presto]
  1. It is possible to exit the venv at any time with the command below:

#+begin_src sh deactivate #+begin_src