I’m almost afraid to ask such a basic question. A Google search shows
that the Internet is awash with all sorts of tutorials but I still
haven’t discovered the answer.
It dawned on me a couple of days ago that gnuradio is not a plug-and
-play SDR, like several of the Windows SDR applications that I’ve played
with, but a series of building blocks. My journey into gnuradio came to
a halt very quickly.
My question is, how do I tell Python (I’m using it from the command
line, no IDE yet) where the modules are located? As in the following
example.
from rtlsdr import *
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named rtlsdr
Type $PYTHONPATH in bash what does it return? Also from the Python
interpreter (type python in bash), type
import sys
sys.path
What does this return?
They should return things like /usr/lib64 (and
lib)/python2.7/site-packages and /usr/local/lib64 (and
lib)/python2.7/site-packages.
So what python does when it looks for a module to import, it looks in
those folders defined by pythonpath and sys.path. If you want to
import a package that’s called rtlsdr, there should be a folder in one
of the site-packages folders called rtlsdr. Additionally in that
folder there should be a init.py file. That’s how finding modules
works in a nutshell.
If you didn’t have a PYTHONPATH, type this into a bash prompt to set
one (it will set for that user only)