Motorcortex-python Installation
2 minute read
Install Python 3
By default Python 3 should already be installed on your Ubuntu distribution.
If not use your package manager to install python3. On Ubuntu you can use apt in the command line:
sudo apt install python3
Installing Motorcortex-Python
Motorcortex-python can be installed by using the pip
tool.
-
To be able to use pip to install python packages this first needs to be installed:
sudo apt install python3-pip
-
Then download, build and install the motorcortex-python package via pip.
sudo -H pip3 install motorcortex-python
Note
This will install motorcortex-python for Python3 for all users.
-
Congratulations Motorcortex-python is now installed
Install Virtual Environment
Motorcortex-python can also be installed inside a virtual environment. This can be useful if your system has a different python environment than the one required for Motorcortex or if you would like to keep the Motorcortex-python tools separate from the rest of the system for security reasons. A Virtual Environment, is an isolated working copy of Python which allows you to work on a specific project without worry of affecting other projects.
Installing Virtualenv
-
Check if virtual environment is already installed on your system you can check this using the following command:
virtualenv --version
-
If you see a version number for instance 1.6.1 it is already installed. If not you will have to install Vitrualenv:
sudo apt-get install virtualenv
Setting up Vitrualenv
-
You will need a directory for your virtual enviroment. You may choose any location you desire:
mkdir ~/virtualenvironment
-
To create a folder for your new app that includes a clean copy of Python3 run:
virtualenv -p python3 ~/virtualenvironment/mcx-env
-
We have created this new folder called mcx-env. To begin cd into your new project:
cd ~/virtualenvironment/mcx-env/bin
-
Now you are in your virtual environment folder you can activate your virtual environment:
source activate
-
Notice your prompt will have a shell in this case (mcx-env). If you would like to leave your virtual environment type the following command:
deactivate
Installing Motorcotex-Python in Vitrualenv
-
Motorcortex-python can be installed by using the “pip” tool. download, build and install the motorcortex-python package via pip.
pip3 install motorcortex-python
-
Congratulations Motorcortex-python is now installed in your virtual environment.