Installing PyPDF4 on Python3.9 on a MacBook Pro

I have the latest Python 3.9 with pip3 and ran "pip install ."PyPDF4-1.27.0.tar.gz" from the terminal

and it reported "Successfully installed PyPDF4-1.27.0"

but my Python3.9 code reports "ImportError: No module named PyPDF4"

I suspect that the Python2.7 code in the OS has confused things, but some say that it cannot be removed without corrupting the OS.


Is there any hope of installing PyPDF4 on my MacBook Pro?



MacBook

Posted on Feb 2, 2021 4:49 PM

Reply
Question marked as Top-ranking reply

Posted on Feb 3, 2021 4:28 AM

The installation of PyPDF4 is as simple as what is documented on its PyPI site:


pip3 install PyPDF4


When you install the Python 3.9.1 package from Python.org, it is installed in:


/Library/Frameworks/Python.framework/Versions/3.9


and the executables in that associated bin directory are linked into /usr/local/bin, including python3, idle3, and pip3.


That installer also updates a specific PATH environment in the ~/.bash_profile placing that Python3 library path at the beginning of your existing PATH environment variable. It does not automatically do this for ~/.zshrc, so caveat emptor should you be running zsh instead of bash.


The importance of this PATH adjustment is that when you run python3 or attempt to install any third-party packages into it, they go into this 3.9 distribution, and nowhere else, and the System Python 2.7.16, or the Python 3.8.2 distribution installed by the command-line tools for Xcode 11 and later — do not mess with you.


I actually created a Python 3.9.1 virtual environment (venv) in a folder, where I install all of my third-party packages (pyobjc, pyinstaller, PyQt5, etc.) and when I activate the venv and change directory into it, I am isolated from all other Pythons.

Similar questions

1 reply
Question marked as Top-ranking reply

Feb 3, 2021 4:28 AM in response to armchair_pilot

The installation of PyPDF4 is as simple as what is documented on its PyPI site:


pip3 install PyPDF4


When you install the Python 3.9.1 package from Python.org, it is installed in:


/Library/Frameworks/Python.framework/Versions/3.9


and the executables in that associated bin directory are linked into /usr/local/bin, including python3, idle3, and pip3.


That installer also updates a specific PATH environment in the ~/.bash_profile placing that Python3 library path at the beginning of your existing PATH environment variable. It does not automatically do this for ~/.zshrc, so caveat emptor should you be running zsh instead of bash.


The importance of this PATH adjustment is that when you run python3 or attempt to install any third-party packages into it, they go into this 3.9 distribution, and nowhere else, and the System Python 2.7.16, or the Python 3.8.2 distribution installed by the command-line tools for Xcode 11 and later — do not mess with you.


I actually created a Python 3.9.1 virtual environment (venv) in a folder, where I install all of my third-party packages (pyobjc, pyinstaller, PyQt5, etc.) and when I activate the venv and change directory into it, I am isolated from all other Pythons.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Installing PyPDF4 on Python3.9 on a MacBook Pro

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.