Install openpyxl on python 2.7 on Win7 report: 'module' object has no attribute 'packaging'

2.3k Views Asked by At

I had downloaded openpyxl2.2.2 and 2.2.4, unzipped them, entered the folders and then input "python setup.py install". It was reported as below

Traceback (most recent call last):  

   File "setup.py", line 30, in <module>

     from setuptools import setup, Extension, find_packages

   File "C:\Python27\lib\site-packages\setuptools\__init__.py", line 11, in <module> 
     from setuptools.extension import Extension

   File "C:\Python27\lib\site-packages\setuptools\extension.py", line 8, in <module>
     from .dist import _get_unpatched

   File "C:\Python27\lib\site-packages\setuptools\dist.py", line 21, in <module>
     packaging = pkg_resources.packaging

AttributeError: 'module' object has no attribute 'packaging'
2

There are 2 best solutions below

0
On

I'm assuming you're doing this from your command prompt window. You need to change the directory to the proper file.

Let's say you moved your unzipped folders into C:\openpyxl

At the command prompt window do the following:

  1. cd C:\openpyxl
  2. python setup.py install

Make sure you see the setup.py folder directly in openpyxl folder, not another subfolder.

0
On

you could try

    sudo apt-get install python-setuptools

I got the similar error as yours when trying to install pyttsx, and got the solution from the net, forgot the site,