Cannot install PyPdf 2 module

geogeek picture geogeek · Oct 8, 2012 · Viewed 23.9k times · Source

Trying to install PyPdf2 module, I downloaded the zip and unzipped it, I executed python setup.py build and python setup.py install, but it seems that it has not been installed , when I try to import it from a python script, it returns an ImportError:

import pyPdf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pyPdf

Any help please.

I'm using python 2.7 under windows XP.

Answer

user707650 picture user707650 · Oct 8, 2012

It appears the README file for PyPDF2 is incorrect. It suggests that

import pyPdf

should work, but it doesn't. This new module is imported as

import PyPDF2

(as suggested by the document structure on github, and after verifying myself).

For convenience, when e.g. working with older code, you can of course do

import PyPDF2 as pyPdf