Tho*_*omi 5 python github distutils2
我有一个setup.py
正在处理的项目的文件,需要提供几个尚未在奶酪店中发布的第三方软件包.其中一个是来自这个git存储库的'spine'和'pyguts'模块:
https://github.com/terrysimons/spine-python
通常我可以通过在我的setup.py文件中指定以下项来从gitgub安装东西(为清楚起见,省略了几行):
#! /usr/bin/python
# Encoding: UTF-8
from setuptools import setup, find_packages
setup(
# More stuff in here...
dependency_links=[
'https://github.com/bitcraft/PyTMX/archive/master.zip#egg=PyTMX',
],
install_requires=[
'PyTMX',
],
)
Run Code Online (Sandbox Code Playgroud)
但是,这只能起作用,因为PyTMXsetup.py
在存储库的根目录中有它的文件.
如果我尝试为spine
和pyguts
存储库做类似的事情,就像这样:
#! /usr/bin/python
# Encoding: UTF-8
from setuptools import setup, find_packages
__version__ = '0.0.1'
setup(
dependency_links=[
'https://github.com/bitcraft/PyTMX/archive/master.zip#egg=PyTMX',
'https://github.com/terrysimons/spine-python/archive/master.zip#egg=spine',
],
install_requires=[
'PyTMX',
'spine',
],
)
Run Code Online (Sandbox Code Playgroud)
然后distutils抱怨我跑python setup.py install
:
Searching for spine
Best match: spine [unknown version]
Downloading https://github.com/terrysimons/spine-python/archive/master.zip#egg=spine
Processing master.zip
error: Couldn't find a setup script in /tmp/easy_install-OXsH6T/master.zip
Run Code Online (Sandbox Code Playgroud)
当setup.py
文件不在包存储库的根目录中时,如何安装distutils来安装包?
据我所知,解决方法是将模块作为子目录包含在包中,而不是安装它们。
显然,这意味着您将无法从模块外部直接访问它们。尽管如此,您仍将能够import my_module.my_submodule
当它们准备好与主模块解耦时,只需为它们制作新的包即可。
归档时间: |
|
查看次数: |
278 次 |
最近记录: |