Search code examples
pythonraspberry-piraspbian

Python cannot find module


So I've updated some of my pies. That implied that one of them, on which I had some python scripts, got demoted, and a new one arose in it's place. So I've moved my scripts.

One script needs the pastebin module. I have taken to install pastebin. With pip.

Now pip, says everything is installed successfully. I beg to differ. Running my script I get a

ImportError: No module named pastebin

pip list says

Pastebin (1.1.1)
pip (7.1.2)
setuptools (19.1.1)
wheel (0.26.0)

now, if I write pyt and double tap the tab key I see

python python2 python2.7

and for pip

pip pip2 pip2.7
python --version

says

Python 2.7.9

So, where in Gods name is my module installed, and how can I get python to see it?

Needless to say, I've reinstalled both python and pip multiple times. This is on a fresh install of raspbian.

EDIT 1

So, running

python -c "import site; print(site.getsitepackages())" 

I get

['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] 

/usr/local/lib/python2.7/dist-packages contains Pastebin.

The other one doesn't

Running

python -c "import sys; print(sys.path)" 

I get

['', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-arm-linux-gnueabihf', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages'] 

Edit2 Running

help('modules') 

I get a list of modules which doesn't contain pastebin. And I've already installed a virtualenv for my project, in which I've installed pastebin with pip


Solution

  • try this:

    Download pastebin from here: https://pypi.python.org/pypi/Pastebin/1.1.1

    python setup.py install