PyPDF2 won't import
Solution 1
You can install PyPDF2 by using the following command,
pip install PyPDF2
Solution 2
PyPDF2 is compatible with Python 3.4, so that's not the problem.
In which Python version do you have pip installed? Even though you're on python34
, if pip is installed to a different version it will download libraries to that version.
In any case, you can always install by downloading from PyPI, then running setup.py install
.
Still, the only possible explanation I have is that the current Python version you're on does not have PyPDF2 installed. See if you can import PyPDF2 from any of the other versions.
Admin
Updated on July 09, 2022Comments
-
Admin almost 2 years
Hi I'm just getting started with python and trying to get some requisite libraries installed. Using Python 3.4.1 on OS X. I have installed PyPDF2 (with supposed success), yet I cannot seem to use the tools:
sh-3.2# port select --list python Available versions for python: none python25-apple python26 python26-apple python27-apple python34 (active) sh-3.2# pip install PyPDF2 Requirement already satisfied (use --upgrade to upgrade): PyPDF2 in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages Cleaning up... sh-3.2#
...
import PyPDF2 Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import PyPDF2 ImportError: No module named 'PyPDF2' >>>
Am I missing a step? Or is PyPDF2 not supported in py3.4.1?
-
itsraghz almost 5 yearsHow do we really link the PyPDF2 to a different version of Python? I do have several version of Python installed in my Mac (Python 2.6, 2.7, 3.6 etc.,)
-
Zweedeend over 4 yearsI usually install using
python3.4 -m pip install PyPDF
. You can change the version of python here, and it will install for the right python version.