在Windows上的python2.5上安装Openpyxl

时间:2013-08-22 19:50:07

标签: python openpyxl

我尝试了easy_install install openpyxlpython setup install。都失败了。我也试过easy_install openpyxl并再次失败。我包括我得到的输出 当我尝试easy_install install openpyxl时,我得到以下输出:

Searching for install
Reading https://pypi.python.org/simple/install/
Download error on https://pypi.python.org/simple/install/: timed out -- Some pac
kages may not be found!
Couldn't find index page for 'install' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: timed out -- Some packages ma
y not be found!
No local packages or download links found for install
error: Could not find suitable distribution for Requirement.parse('install')

当我尝试当我尝试easy_install openpyxl时,我会得到相同的输出但是使用'openpyxl'而不是'install'。
当我尝试python setup install时,我得到以下输出:

Traceback (most recent call last):
  File "setup.py", line 23, in <module>
    import openpyxl  # to fetch __version__ etc
  File "D:\Python\Excel\ericgazoni-openpyxl-22d4b2135553\openpyxl\__init__.py",
line 32, in <module>
    from openpyxl import workbook
  File "D:\Python\Excel\ericgazoni-openpyxl-22d4b2135553\openpyxl\workbook.py",
line 37, in <module>
    from openpyxl.writer.dump_worksheet import DumpWorksheet, save_dump
  File "D:\Python\Excel\ericgazoni-openpyxl-22d4b2135553\openpyxl\writer\__init_
_.py", line 29, in <module>
    from openpyxl.writer import excel
  File "D:\Python\Excel\ericgazoni-openpyxl-22d4b2135553\openpyxl\writer\excel.p
y", line 50, in <module>
    from openpyxl.writer.charts import ChartWriter
  File "D:\Python\Excel\ericgazoni-openpyxl-22d4b2135553\openpyxl\writer\charts.
py", line 27, in <module>
    from openpyxl.chart import Chart, ErrorBar
  File "D:\Python\Excel\ericgazoni-openpyxl-22d4b2135553\openpyxl\chart.py", lin
e 132, in <module>
    class Serie(object):
  File "D:\Python\Excel\ericgazoni-openpyxl-22d4b2135553\openpyxl\chart.py", lin
e 150, in Serie
    @color.setter
AttributeError: 'property' object has no attribute 'setter'

有什么建议吗?

5 个答案:

答案 0 :(得分:8)

只需从here下载,然后将其解压缩并将openpyxl-1.6.2\openpyxl文件夹复制到:

C:\Python27\Lib

应该这样做(默认情况下该目录应添加到python path)。这假设默认的python安装目录。如果您已在其他地方安装了python,只需将openpyxl放入相应的lib目录。

我是openpyxl的粉丝,但现在,事后我推荐driving Excel through the COM ports(只要您获得Excel许可)。

答案 1 :(得分:2)

1.7版是最后一个适用于Python 2.5的版本。决定放弃对Python 2.5的支持主要是因为Python软件基金会不再支持Python 2.5本身。

答案 2 :(得分:1)

在python3中上面提到的方法不起作用。只需从他们的官方网站下载openpyxl并解压缩压缩文件夹即可。您可以将该文件夹放在桌面上。之后,从cmd导航到openpyxl文件夹。 你要做的是执行命令

python setup.py install

一切正常!!!

答案 3 :(得分:0)

作为Charlie Clark stated,您需要安装旧版本:

easy_install "openpyxl<=1.7.0"

pip install "openpyxl<=1.7.0"

字符串是requirement specifier

答案 4 :(得分:-2)

将您下载的文件夹解压缩到C:\ Python27 \ Lib并将openpyxl-2.4.1重命名为openpyxl,然后照常导入库

相关问题