Getting Started With Python
Installing Python 3 on macOS with Homebrew
To begin, Python 3 must be installed. There are several ways to install Python 3 (through the Python website, Anaconda, Homebrew).
To use Homebrew, first install Homebrew by typing the following into the command line:
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you use zsh, add Homebrew to your PATH with this command:
% echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/[username]/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"
[username] is replaced by your own specific machine username. These two commands will also appear in terminal after Homebrew is installed under
Next Steps: and can be copied from there. If you use bash, add Homebrew to your PATH with the command:
% echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile
Finally, to install Python 3, use the command
% brew install python3
Installing Python 3 and Setting Up Port Access on Linux
To install Python 3 on a Linux machine, type the following into the command line:
% sudo apt install python3
Additionally, you will need to make sure you have the pip command. To do this, type
% sudo apt install python3-pip
into the command line. Finally, in order to access the port where the sensor is attached, you will need to make sure that your Linux account is in the group "dialout". To see what groups your account is in type:
into the command line. If you do not see
dialout type the following command to add yourself to the dialout group:
% sudo usermod -a -G dialout [username]
[username] is replaced by your own specific account username. Then, you will need to completely log out and log back in before continuing. Once you have logged back in, type
again and make sure that the group
Installing Python3 on Windows
Python3 can be installed on Windows machines using the python.org installer. Alternatively, you can also download it from the Microsoft Store. Open the Microsoft Store through your Start menu in the lower left. Once in the Microsoft Store, search for Python, and install the latest version of Python. To check if installation was successful, type
% Python --version
into your Command Prompt. It is also helpful to make sure that
pip was included in this installation. To confirm that you can use
% pip --version
into your Command Prompt.
If a command not found error appears after any installation step, try running the command in new command window. For any additional help, please contact us. We are here to support you! Once you have installed Python, start using Twinleaf's TIO package to establish communication with your device. Instructions for this can be found on our Getting Started With TIO Python page.