Erle Robotics Python Networking Gitbook Free

Create a virtual environment to test packages

We are now going to use virtualenv to create a new environment and intall the googlemapspackage on it. You can read more about this package here.

Now you type the following:

[email protected]:~# virtualenv --no-site-packages gmapenv
New python executable in gmapenv/bin/python
Installing setuptools, pip...done.
[email protected]:~#
[email protected]:~# cd gmapenv
[email protected]:~/gmapenv# ls
bin  include  lib  local
[email protected]:~/gmapenv# . bin/activate
(gmapenv)[email protected]:~/gmapenv# python -c 'import googlemaps'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named googlemaps
(gmapenv)[email protected]:~/gmapenv#

As you can see, the googlemaps package is not yet available. To install it, use the pip command that is inside your virtualenv and that is now on your path thanks to the activate command that you ran:

(gmapenv)[email protected]:~/gmapenv#  pip install googlemaps
Downloading/unpacking googlemaps
Downloading googlemaps-1.0.2.tar.gz (60Kb): 60Kb downloaded
Running setup.py egg_info for package googlemaps
Installing collected packages: googlemaps
Running setup.py install for googlemaps
Successfully installed googlemaps
Cleaning up...

The python binary inside the virtualenv will now have the googlemaps package available:

(gmapenv)[email protected]:~/gmapenv# python -c 'import googlemaps'

When you install a packet, you should be carefull: it must be suitable for Erle architecture.