Search code examples
pythonpypdf

No module named 'PyPDF2' when is importing


I have an error with import PyPDF2 (No module named). I tried to install for Python ver. 2, also don't work. I suppose that problem maybe connected with path of install module, but I can't change it... or with version Python, because in documentation said about ver 3.2-3.5

https://pythonhosted.org/PyPDF2/About%20PyPDF2.html

cmd

C:\Users\Xiaomi>pip3 install PyPDF2 Requirement already satisfied: PyPDF2 in c:\users\xiaomi\appdata\local\programs\python\python36\lib\site-packages (1.26.0)

C:\Users\Xiaomi>py Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

import PyPDF2 ModuleNotFoundError: No module named 'PyPDF2'

import sys print(sys.path) ['', 'C:\Users\Xiaomi\Anaconda3\python37.zip', 'C:\Users\Xiaomi\Anaconda3\DLLs', 'C:\Users\Xiaomi\Anaconda3\lib', 'C:\Users\Xiaomi\Anaconda3', 'C:\Users\Xiaomi\Anaconda3\lib\site-packages', 'C:\Users\Xiaomi\Anaconda3\lib\site-packages\win32', 'C:\Users\Xiaomi\Anaconda3\lib\site-packages\win32\lib', 'C:\Users\Xiaomi\Anaconda3\lib\site-packages\Pythonwin']


Solution

  • I think you are installing PyPDF2 in a different directory from your working directory. You need to install it in the same directory.