我正在尝试使用setuptools为sage脚本构建一个安装程序。这是我所拥有的。
我的setup.py文件:
#!/usr/bin/env python2
from setuptools import setup
__name__ = 'sage-test'
__version__ = '0.0'
setup(name=__name__,
scripts=['sage-test'],
)sage-test文件:
#!/usr/bin/env sage
from sage.all import GF
print(GF(5))我现在做./setup.py build和./setup.py install。当我尝试运行sage-test时,我得到以下错误:
Traceback (most recent call last):
File "/usr/bin/sage-test", line 4, in <module>
__import__('pkg_resources').run_script('sage-test==0.0.0', 'sage-test')
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 517, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1443, in run_script
exec(script_code, namespace, namespace)
File "/usr/lib/python2.7/site-packages/sage_test-0.0.0-py2.7.egg/EGG-INFO/scripts/sage-test", line 3, in <module>
__requires__ = 'sage-test==0.0.0'
ImportError: No module named sage.all你有什么办法让它工作吗?(请注意,我可以在当前目录中运行./sage-test,一切都可以正常工作。)
发布于 2014-11-14 02:35:43
这可能没有帮助,但这看起来很可疑。
/usr/lib/python2.7/也许你需要在sage -sh中做所有的事情--如果有一些环境变量没有正确设置,我也不会感到惊讶。我不知道确切的原因,但也许它以某种方式拾取了你的系统Python。
https://stackoverflow.com/questions/26914928
复制相似问题