import openpyxl / ModuleNotFoundError: No module named 'openpyxl'

1

When I type in IDLE, import openpyxl, the following error message appears:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import openpyxl
ModuleNotFoundError: No module named 'openpyxl' 

I searched the internet how to solve this, in the terminal I typed:

sudo pip3 install openpyxl

Appeared:

MBP-de-Edson:~ edson$ sudo pip3 install openpyxl
Password:

The directory '/Users/edson/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/edson/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: openpyxl in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requirement already satisfied: jdcal in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from openpyxl)
Requirement already satisfied: et_xmlfile in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from openpyxl)

Then they told me to type in the command line:

sudo pip3 -H  install openpyxl

But the error in importing openpyxl continues to occur.

Environment:

  • OS -Sierra - 10.12.6
  • Python 3.6.2 (v3.6.2: 5fd33b5926, Jul 16 2017, 20:11:06)
asked by anonymous 06.09.2017 / 17:05

1 answer

0

Activate the virtual work environment and run easy_install:

$ source venv/py36/bin/activate
$ easy_install openpyxl 
    
26.06.2018 / 17:38