【发布时间】:2013-11-06 07:40:47
【问题描述】:
下面是我的 setup.py 代码:
from os import path
import sys
python_version = sys.version_info[:2]
if python_version < (2, 6):
raise Exception("This version of xlrd requires Python 2.6 or above. "
"For older versions of Python, you can use the 0.8 series.")
av = sys.argv
if len(av) > 1 and av[1].lower() == "--egg":
del av[1]
from setuptools import setup
else:
from distutils.core import setup
from xlrd.xlrd.info import __VERSION__ as p
from xlwt.xlwt import __VERSION__
DESCRIPTION = (
'Library to create spreadsheet files compatible with '
'MS Excel 97/2000/XP/2003 XLS files, '
'on any platform, with Python 2.3 to 2.7'
)
CLASSIFIERS = [
'Operating System :: OS Independent',
'Programming Language :: Python',
'License :: OSI Approved :: BSD License',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Office/Business :: Financial :: Spreadsheet',
'Topic :: Database',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries',
]
KEYWORDS = (
'xls excel spreadsheet workbook worksheet pyExcelerator'
)
setup(
name = 'xlrd',
version = p,
author = 'John Machin',
author_email = 'sjmachin@lexicon.net',
url = 'http://www.python-excel.org/',
packages = ['xlrd'],
scripts = [
'xlrd/scripts/runxlrd.py',
],
package_data={
'xlrd/xlrd': [
'doc/*.htm*',
# 'doc/*.txt',
'examples/*.*',
],
},
keywords = ['xls', 'excel', 'spreadsheet', 'workbook'],
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Operating System :: OS Independent',
'Topic :: Database',
'Topic :: Office/Business',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
setup (
name = 'xlwt',
version = __VERSION__,
maintainer = 'John Machin',
maintainer_email = 'sjmachin@lexicon.net',
url = 'http://www.python-excel.org/',
download_url = 'http://pypi.python.org/pypi/xlwt',
description = DESCRIPTION,
long_description = LONG_DESCRIPTION,
license = 'BSD',
platforms = 'Platform Independent',
packages = ['xlwt'],
keywords = KEYWORDS,
classifiers = CLASSIFIERS,
package_data = {
'xlwt/xlwt': [
'doc/*.*',
'examples/*.*',
'tests/*.*',
],
},
)
我已经尝试在这里合并xlrd 和xlwt 中的setup.py 并尝试运行master setup.py 以一次性安装这两个模块。它正在安装模块而不是属性,因此无法使用这些模块。基本上我的需要是运行一个脚本并在客户端机器上安装多个模块。有可能吗?如果有其他方法可以做到这一点,请指导我。提前致谢。
【问题讨论】:
-
你说的是哪些属性?
-
@BasicWolf 我正在尝试运行脚本
import xlrd workbook = xlrd.open_workbook('my_workbook.xls')它正在抛出错误AttributeError: 'module' object has no attribute 'open_workbook' -
好吧,这意味着你至少可以导入xlrd模块。
dir(xlrd)打印出什么? -
正在打印
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__'] -
嗯.. 你用的是什么安装系统?是设置工具吗?分发?分发工具?因为我看不到任何表明这一点的导入。
标签: python python-2.6