2013-08-22 21 views
7

我試過easy_install install openpyxlpython setup install。兩個失敗。我也試過easy_install openpyxl並再次失敗。我包括我得到的輸出。
當我嘗試easy_install install openpyxl,我得到下面的輸出:在Windows上的python2.5上安裝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」「安裝」。
當我嘗試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' 

有什麼建議?

回答

7

剛剛從here下載,解壓和openpyxl-1.6.2\openpyxl文件夾複製到:

C:\Python27\Lib 

應該這樣做(該目錄默認情況下應添加到您的python path)。這假定默認的python安裝目錄。如果你在其他地方安裝了python,只需將openpyxl放入相應的lib目錄即可。

我是openpyxl的粉絲,但現在事後看來,我推薦driving Excel through the COM ports(只要你有Excel的許可證)。

+0

它也不能工作。我嘗試將openpyxl-1.6.2(及其所有內容)複製到C:\ Python25 \ Lib中,並將其複製到C:\ Python25 \ Lib \ site-packages中。 –

+0

注意我需要使用Python 2.5。 –

+0

我會給[通過COM端口驅動Excell](http://pythonexcels.com/basic-excel-driving-with-python/)一試! –

2

版本1.7是使用Python 2.5的最新版本。決定放棄對Python 2.5的支持很大程度上是因爲Python Software Foundation不再支持Python 2.5本身。

0

在python3上面提到的方法不起作用。只需從他們的官方網站下載openpyxl並提取壓縮文件夾即可。您可以將該文件夾放在桌面上。之後,從cmd導航到openpyxl文件夾。 你要做的是執行命令

python setup.py install 

和一切工作正常!

-2

只需提取你下載到C中的文件夾:\ Python27 \ Lib文件並重新命名openpyxl-2.4.1作爲openpyxl,然後導入庫照常

+1

這與答案接受的答案完全相同。 –