我尝试了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')
当我尝试当我尝试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'
有什么建议吗?
答案 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)
答案 4 :(得分:-2)
将您下载的文件夹解压缩到C:\ Python27 \ Lib并将openpyxl-2.4.1重命名为openpyxl,然后照常导入库