添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
憨厚的大脸猫  ·  python ...·  4 天前    · 
霸气的花卷  ·  python list 错位相减 ...·  4 天前    · 
帅气的领带  ·  【Pyspark ...·  2 天前    · 
近视的橙子  ·  python ...·  4 小时前    · 
怕老婆的大熊猫  ·  FATAL ERROR ...·  4 月前    · 
小胡子的蛋挞  ·  Convenient SLURM ...·  6 月前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi there,

I tried to install PyPDF2 via pip using python 3.6 on MacOS with the command:
pip3 install PyPDF2
Unfortunately when trying to import PyPDF2, it get a ModuleNotFoundError.

Through my search, I also stumbled over some dependency to pdfmerge, but installing it just threw another error. Regarding to other people who had the same problem, setuptools has to be updated.
But running
pip3 install --upgrade setuptools
did not help. I hope this is the right place to report/ask for help.
Thanks!

On Ubuntu 18.04 with Python 3.6.7 there seems to be no issue.

~/Projects/test_pypdf2$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyPDF2
>>> dir(PyPDF2)
['PageRange', 'PdfFileMerger', 'PdfFileReader', 'PdfFileWriter', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_version', 'filters', 'generic', 'merger', 'pagerange', 'parse_filename_page_ranges', 'pdf', 'utils']
>>> PyPDF2.PdfFileMerger
<class 'PyPDF2.merger.PdfFileMerger'>
          

Not a "proper" fix for your problem, but you can clone the PyPDF2 github repo into your working directory for whichever python script you're working on, then do an import.

Project Directory:

  • yourScript.py
  • PyPDF2
  • In yourScript.py:
    import PyPDF2.pdf
    from PyPDF2.pdf import PdfFileReader

    If you have things organized like this, it should work perfectly.

    is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF label Apr 7, 2022
    This allows the project to make use of modern Python packaging features such as wheels, isolated builds, and more.
    The change is also going to be necessary soon; distutils will soon be deprecated in 3.10, and removed from the standard library in 3.12.
    Closes #465
    Closes #313
    Might fix #581 , #456

    pypdf is available on pypi.org so you should not meet an issue to install it if your python/network configuration is correct. as an alternative you should download manually the whl file from https://pypi.org/project/pypdf/#files and then pass the whl file as argument :
    pip install file.whl