我有一个我通过python setup.py install
安装的软件包,一直运行良好,直到我今天早上尝试在新机器上安装它。
在以前的计算机上,virtualenv
附带setuptools==2.0.2
,但在我的新计算机上,它现在位于setuptools==3.6
。
现在,当我使用setup.py install
安装软件包时,我无法导入软件包或运行其中包含的脚本。
这是包的setup.py
文件:
__version__ = '1.0.2'
import sys
try:
from setuptools import setup
print 'Loaded setuptools'
except ImportError:
from distutils.core import setup
print 'Loaded distutils.core'
PACKAGE_NAME = 'google-taskqueue-client'
INSTALL_REQUIRES = ['google-apputils==0.1',
'google-api-python-client',
'httplib2',
'oauth2',
'python-gflags']
setup(name=PACKAGE_NAME,
version=__version__,
description='Google TaskQueue API command-line tool and utils',
author='Google Inc.',
author_email='google-appengine@googlegroups.com',
url='http://code.google.com/appengine/docs/python/taskqueue/pull/overview.html',
install_requires=INSTALL_REQUIRES,
packages=['gtaskqueue'],
scripts=['gtaskqueue/gtaskqueue', 'gtaskqueue/gtaskqueue_puller',
'gtaskqueue/gen_appengine_access_token'],
license='Apache 2.0',
keywords='google taskqueue api client',
classifiers=['Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX',
'Topic :: Internet :: WWW/HTTP'])
安装本身运行正常,但我无法使用该软件包的模块。 这是尝试列出其中一个脚本时抛出的错误:
$ which gtaskqueue
/Users/john/.virtualenvs/myenv/bin/gtaskqueue
$ gtaskueue
Traceback (most recent call last):
File "/Users/john/.virtualenvs/myenv/bin/gtaskqueue", line 5, in <module>
pkg_resources.run_script('google-taskqueue-client==1.0.2', 'gtaskqueue')
File "/Users/john/.virtualenvs/myenv/lib/python2.7/site-packages/pkg_resources.py", line 534, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/Users/john/.virtualenvs/myenv/lib/python2.7/site-packages/pkg_resources.py", line 1441, in run_script
exec(script_code, namespace, namespace)
File "/Users/john/.virtualenvs/myenv/lib/python2.7/site-packages/google_taskqueue_client-1.0.2-py2.7.egg/EGG-INFO/scripts/gtaskqueue", line 25, in <module>
ImportError: No module named gtaskqueue
修改
所有依赖项也安装得很好(我必须将'google-apputils==0.1'
要求更新到最新版本)
>>> import google.apputils
>>> import httplib2
>>> import oauth2
>>> import gflags
>>> import oauth2client
>>> import gtaskqueue
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gtaskqueue
编辑2: