Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "ImportError: No module named pdb"

I am running a python virtualenv in OS X.

I have installed pdb using pip in the virtualenv.

But when I run pdb, I get the following error.

Traceback (most recent call last):
  File "/Users/myname/.virtualenvs/myenv/bin/pdb", line 9, in <module>
    load_entry_point('pdb==0.1', 'console_scripts', 'pdb')()
  File "/Users/myname/.virtualenvs/myenv/lib/python2.7/site-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/myname/.virtualenvs/myenv/lib/python2.7/site-packages/pkg_resources.py", line 2431, in load_entry_point
    return ep.load()
  File "/Users/myname/.virtualenvs/myenv/lib/python2.7/site-packages/pkg_resources.py", line 2147, in load
    ['__name__'])
ImportError: No module named pdb
like image 935
pheon Avatar asked Apr 11 '15 22:04

pheon


1 Answers

What did you expect to install here; the Password database or the standard library debugger module?

The stdlib debugger doesn't need installing, but it has no command line interface of its own. You can specify the module on the python command line with the -m switch to set up post mortem debugging; see the module documentation:

python -m pdb yourscript.py
like image 178
Martijn Pieters Avatar answered Nov 10 '22 18:11

Martijn Pieters