For some reason, I seem unable to import certain modules in my macOS Anaconda install of Python.
$which python
/opt/anaconda3/bin/python
I can use some packages (pandas loads fine, for example), but wget and pypdf2 cannot be found. I've removed and installed both again using the following commands:
$conda install -c conda-forge pypdf2
$conda install -c anaconda wget
They appear to be installed:
$conda list
# Name Version Build Channel
pypdf2 1.26.0 pypi_0 pypi
wget 1.20.1 h051b688_0 anaconda
When importing, I get the following 'module not found' errors
>>>import wget
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'wget'
>>>import pypdf2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pypdf2'
Any ideas what's going on here and what else I can do to troubleshoot? Thank you.
wget
is not a Python package. It is a command-line program used to download things from the inte.net. You can use it as wget
on the command-line.
Your error with pypdf2
occurs because you are not importing it properly. Use
import PyPDF2
as per the examples .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.