0

I have PyPDF2 installed with pip, and it works in command line but not work in IDLE. I got the following error with Pycharm:

File "...\PycharmProjects\seperatePDF\seperatePDF.py", line 2, in from PyPDF2 import PdfFileReader, PdfFileWriter ModuleNotFoundError: No module named 'PyPDF2'

Lluoway
  • 1
  • 1
  • Does this answer your question? [Unable to use pypdf module](https://stackoverflow.com/questions/42130504/unable-to-use-pypdf-module) – bad_coder Sep 15 '21 at 22:50
  • Please provide enough code so others can better understand or reproduce the problem. – Community Sep 16 '21 at 06:49

1 Answers1

0

This might occur if you have multiple versions of python installed with different paths. You can check this by opening an idle and using:

import sys
sys.version
sys.path

This will print out the versions you have installed. You'll also need to run the above code in Command Prompt just use python first to run terminal in python.

python
import sys
sys.version
sys.path

After running on both locations, see if the version and paths are the same. If you do have multiple versions installed you can just delete the one you don't need or delete all of them and do a complete reinstall. To find the location where python is saved follow the path you were given above and type it in File Explorer if you want to manually delete it. Mine for example is 'C:\Users\Justin\AppData\Roaming\Python\Python39'. If you have two versions and don't want to delete either one you'll have to change paths in the idle for example:

import os
os.chdir('path you want to use')

Hope this works for you.

j_lee
  • 11
  • 2