Sphero Public SDK

Sphero Public SDK

  • Getting Started
  • How To
  • Documentation
  • Get the Code
  • Samples
  • Troubleshooting
  • FAQs

›Optional Steps

Starting with Raspberry Pi

  • Intro
  • Python SDK Setup

    • 1. Python SDK Setup (Quick Start)
    • 1.a. Python SDK Setup (Advanced)
    • 2. Setting Up Raspberry Pi OS
    • 3. Using the Terminal
    • 4. Using SSH
    • 5. Connecting to RVR+
    • 6. Test it!

    First Programs

    • Hello World - Starting Python
    • Hello RVR+ - LED Control
    • Go Driving

    Optional Steps

    • Choose Your Python Version
    • Using Pipenv

Additional Resources

  • Troubleshooting

Choose Your Python Version

How to find out your Python version

In our instructions, we typically say to run Python scripts with the following command format:

python3 <scriptname.py>

python3 is actually a symbolic link to a specific Python interpreter. Which one? You can find out by entering:

python3 --version

python3 --version output

or use the following command to see how the symbolic link points to the a specific interpreter:

ls -l /usr/bin/python3

python3 symlink output

What if I want to use a different version?

One easy way to accomplish this (and reduce your typing requirements), is to create an alias. You can open the file ~/.bashrc in your favorite text editor and add the following line at the end of the file:

alias py="/usr/bin/python3.7"

Or without a text editor, just enter this command :

echo "\nalias py=\"/usr/bin/python3.7\n\"" > ~/.bashrc

After editing your ~/.bashrc, you'll need to reload it:

source ~/.bashrc

Now, whenever you enter py, your shell will interpret it as a direct call to your python interpreter of choice! And your fingers can rest easy without typing out python3 every time ;)

# Look ma, less typing!
py <scriptname.py>
← Go DrivingUsing Pipenv →
  • How to find out your Python version
  • What if I want to use a different version?
Sphero Public SDK

Wanna stay informed about Public SDK efforts and releases?

Sphero
Public SDK LicenseAbout Sphero Public SDKSphero.comSphero EDU
Community
Sphero CommunityThingiverseTwitterInstagramFacebook
More
RedditLinkedInGitHubStar
Copyright © 2022 Sphero