General Setup¶
In This Section
Installation of Python¶
All Synapse tools require Python 2.7
On OS X:¶
If you do not have Homebrew already installed, you may install it by running the following command in a Terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Add the following line to your ~/.bash_profile if it is not already present:
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Once your ~/.bash_profile has been modified, you will need to source it by typing the following command in a Terminal:
source ~/.bash_profile
Next, execute the following command to install Python 2.7 via Homebrew:
brew install python
On Linux:¶
The latest versions of CentOS, Fedora, Redhat Enterprise (RHEL) and Ubuntu come with Python 2.7 out of the box.
To see which version of Python you have installed, type the following command in a Terminal:
python --version
On Windows:¶
Download the latest Python 2 release from python.org
Installation and Upgrading of pip, setuptools and wheel¶
Pip is a tool for easily installing and managing Python packages. To check if you already have pip installed, type the following command in a Terminal:
pip --version
If you do not have pip already installed, you will need to do a new install as follows:
Securely download get-pip.py
Execute the following command to install pip:
python get-pip.py
This will install or upgrade pip. Additionally, it will install setuptools and wheel if they are not already installed.
If you have Python 2 >= 2.7.9 installed from python.org , or via Homebrew you will already have pip and setuptools installed but will need to upgrade to the latest version:
On Linux or OS X:¶
sudo pip install -U pip setuptools
On Windows:¶
python -m pip install -U pip setuptools
Setting the PATH Variable¶
Next, set your system’s PATH variable to point to directories that include Python components and packages.
On Windows:¶
Open the “Environment Variables” window by navigating to Control Panel > System and Security > System > Advanced System Setting > Environment Variables
In the “User Variables” section, create or find the “Path” variable and select it
Click “Edit”
In the variable “Value” section, add the path to your python installation “;C:Python27” (where “;” separates different paths) as well as “;C:Python27Scripts” to point to the python executables. For example: “;C:Python27;C:Python27Scripts;”
Installation and Creation of a Virtual Environment¶
Python “Virtual Environments” allow Python packages to be installed in an isolated location for a particular application, rather than being installed globally.
To install a virtual environment, execute the following command to install virtualenvwrapper via pip:
On Linux or OS X:¶
sudo pip install virtualenvwrapper
Add the following lines to your shell startup file (.bashrc, .profile, .bash_profile, etc.) to set the location where the virtual environment should live, the location of your development project directories, and the location of the script installed with this package:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
After editing it, reload the startup file (e.g., run source ~/.bashrc).
Once the virtual environment has been installed, create and activate it by executing the following commands:
mkvirtualenv <name of virtual environment> # For example, the name of your project
workon <name of virtual environment>
On Windows:¶
In a regular command prompt, run the following command:
pip install virtualenvwrapper-win
Optional: Add an environment variable WORKON_HOME to specify the path to store environments. By default, this is %USERPROFILE%Envs.
Once the virtual environment has been installed, create and activate it by executing the following commands:
mkvirtualenv <name of virtual environment> # For example, the name of your project
workon <name of virtual environment>