Basic python question

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

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

What does this return?

They should return things like /usr/lib64 (and
lib)/python2.7/site-packages and /usr/local/lib64 (and

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 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)

export 1 >> $PYTHONPATH=/usr/local/lib64/python2.7/site-packages

reference: 6. Modules — Python 3.11.4 documentation

Oops that’s funny I muxed up the echo and export commands! This is what
I meant:

export $PYTHONPATH="/usr/local/lib64/python2.7/site-packages"

On Thu, Jun 7, 2012 at 8:39 AM, Ryan Connelly