在 Windows 上的 python2.5 上安装 Openpyxl
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18389594/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install Openpyxl on python2.5 on Windows
提问by José
I have tried easy_install install openpyxl
and python setup install
. Both failed. I also tried easy_install openpyxl
and failed again. I include the output I get.
When I try easy_install install openpyxl
, I get the following output:
我试过easy_install install openpyxl
和python 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')
When I try When I try easy_install openpyxl
instead, I get the same output but with the word 'openpyxl' instead of 'install'.
When I try python setup install
, I get the following output:
当我尝试当我尝试时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'
Any suggestions?
有什么建议?
采纳答案by Aleksander Lidtke
Just download it from here, extract it and copy the openpyxl-1.6.2\openpyxl
folder into:
只需从这里下载,解压缩并将openpyxl-1.6.2\openpyxl
文件夹复制到:
C:\Python27\Lib
That should do it (that directory should be added to your python path
by default). That assumes default python installation directory. If you've got python installed elsewhere just put the openpyxl
into the corresponding lib
directory.
应该这样做(python path
默认情况下应该将该目录添加到您的目录中)。假设默认python安装目录。如果你已经在别处安装了python,只需将其openpyxl
放入相应的lib
目录即可。
I was a fan of openpyxl
but now, in the hindsight, I'd recommend driving Excel through the COM ports(so long as you've got the license for Excel).
我是它的粉丝,openpyxl
但现在事后看来,我建议通过 COM 端口驱动 Excel(只要你有 Excel 的许可证)。
回答by Charlie Clark
Version 1.7 is the last version that works with Python 2.5. The decision to drop support for Python 2.5 was largely because Python 2.5 itself is no longer supported by the Python Software Foundation.
1.7 版是最后一个适用于 Python 2.5 的版本。决定放弃对 Python 2.5 的支持主要是因为 Python 软件基金会不再支持 Python 2.5 本身。
回答by ivan_pozdeev
As Charlie Clark stated, you need to install an old version:
正如查理克拉克所说,你需要安装一个旧版本:
easy_install "openpyxl<=1.7.0"
or
或者
pip install "openpyxl<=1.7.0"
the string is a requirement specifier.
该字符串是一个需求说明符。
回答by dilantha111
In python3 The above mention methods are not working. Just download the openpyxl from their official web site and extract the zipped folder. And you may place that folder on your desktop. After that navigate to the openpyxl folder from the cmd. what you have to do is execute the command
在 python3 中,上述方法不起作用。只需从他们的官方网站下载 openpyxl 并解压缩压缩文件夹。您可以将该文件夹放在桌面上。之后从 cmd 导航到 openpyxl 文件夹。你要做的就是执行命令
python setup.py install
and everything works fine !!!
一切正常!
回答by Alexander Gonzalez Ilufi
Just extract the folder you downloaded into C:\Python27\Lib and rename openpyxl-2.4.1 as openpyxl, then import the library as usual
只需将您下载的文件夹解压到 C:\Python27\Lib 并将 openpyxl-2.4.1 重命名为 openpyxl,然后照常导入库