Egbert Lin's Blog

“Life is not a race, but a journey to be savoured each step of the way” by Brian Dyson

Run PyCharm: Python development platform on Ubuntu (Ryu SDN)

Tutorial - PyCharm Installation and build project environment for the development of Ryu controller

What is PyCharm?

Are you developing python project on Ubuntu right now? When you are writing code, I guess that you edit file by vi, vim or 'gedit'. Maybe these tools are convenient to you, but those are inefficient and hard to maintain program for the development of big projet.

PyCharm is one of the most popular Python IDEs. It provides code analysis, a graphical debugger, an integrated unit tester, integration with version control systems (VCSes), and supports web development with Django as well as data science with Anaconda.

And, it is cross-platform, compatible with Windows, macOS and Linux versions. Also, it supports both Python 2 (2.7) and Python 3 (3.5 and above) versions.

Installation

  • Step 1. Download the PyCharm to your Ubuntu system

  • Step 2. Unpack the pycharm-*.tar.gz file (The recommended installation location according to the filesystem hierarchy standard (FHS) is /opt.)

    1
    $ sudo tar xfz pycharm-*.tar.gz -C /opt/

  • Step 3. Go to the bin subdirectory

    1
    $ cd /opt/pycharm-*/bin

  • Step 4. Run pycharm.sh from the bin subdirectory

    1
    $ ./pycharm.sh

  • Step 5. Choose “Do not import settings” as below:

  • Step 6. Select the user interface theme

  • Step 7. Download and install additional pyugins

  • Step 8. Start a project in PyCharm

Debug Ryu SDN controller

  • Step 1. First, build a new project. Then, create a python file (compile file)

  • Step 2. Paste the code as below: (Notice: you must set your directory of controller.py)

  • Step 3. Create a controller.py (You can paste the source code of simple_switch_13.py to controller.py)

  • Step 4. Change a project interpreter 3.4 to 2.7 version (File->settings->Project->Project Interpreter)

  • Step 5. Finally, debugging the controller.py and get currect result