PyBrain - Environment Setup


Advertisements

In this chapter, we will work on the installation of PyBrain. To start working with PyBrain, we need to install Python first. So we are going to work on following −

  • Install Python
  • Install PyBrain

Installing Python

To install Python, go to the Python official site: www.python.org/downloads as shown below and click on the latest version available for windows, Linux/Unix and macOS. Download Python as per your 64- or 32-bit OS available with you.

Installing Python

Once you have downloaded, click on the .exe file and follow the steps to install python on your system.

Setup Progress

The python package manager, i.e., pip will also get installed by default with the above installation. To make it work globally on your system, directly add the location of python to the PATH variable, the same is shown at the start of the installation to remember to check the checkbox which says ADD to PATH. In case you forget to check it please follow the below given steps to add to PATH.

Add to PATH

To add to PATH, follow the below steps −

  • Right-click on your Computer icon and click on properties -> Advanced System Settings.

  • It will display the screen as shown below

System Properties
  • Click on Environment Variables as shown above. It will display the screen as shown below

Environment Variables

Select Path and click on Edit button, add the location path of your python at the end. Now let us check the python version.

Checking for Python version

The below code helps us in checking the version of Python −

E:\pybrain>python --version
Python 3.7.3

Installing PyBrain

Now that we have installed Python, we are going to install Pybrain. Clone the pybrain repository as shown below −

git clone git://github.com/pybrain/pybrain.git

C:\pybrain>git clone git://github.com/pybrain/pybrain.git
Cloning into 'pybrain'...
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 12177 (delta 0), reused 0 (delta 0), pack-reused 12175
Receiving objects: 100% (12177/12177), 13.29 MiB | 510.00 KiB/s, done.
Resolving deltas: 100% (8506/8506), done.

Now perform cd pybrain and run following command −

python setup.py install

This command will install pybrain on your system.

Once done, to check if pybrain is installed or not, open command line prompt and start the python interpreter as shown below −

C:\pybrain\pybrain>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

We can add import pybrain using the below code −

>>> import pybrain
>>>

If the import pybrain works without any errors, it means pybrain in installed successfully. You can now write your code to start working with pybrain.

Advertisements