使用setup.py和setup.cfg

时间:2016-11-16 12:34:33

标签: python

我有以下目录结构:

/modules/
/modules/setup.py
/modules/setup.cfg

/modules/module1/
/modules/module1/__init__.py
/modules/module1/tool1/__init__.py
/modules/module1/tool1/tool1.py

/modules/module2/
/modules/module2/__init__.py
/modules/module2/tool2/__init__.py
/modules/module2/tool2/tool2.py
/modules/module2/tool3/__init__.py
/modules/module2/tool3/tool3.py

我想使用setup.py和setup.cfg安装这些模块并稍后导入它们,如下所示:

import my_project.module1.tool1 
import my_project.module2.tool2
import my_project.module2.tool3 

这些是我的安装文件:

setup.py

import setuptools

setuptools.setup(
    setup_requires=['paramiko>=2.0.1'],
    paramiko=True)

setup.cfg

[metadata]
name = my_project
summary = my project modules

[files]
packages =
    module1
    module2

尝试安装软件包时失败:

/modules# pip install -e .
Obtaining file:///modules
Installing collected packages: UNKNOWN
  Found existing installation: UNKNOWN 0.0.0
    Can't uninstall 'UNKNOWN'. No files were found to uninstall.
  Running setup.py develop for UNKNOWN
Successfully installed UNKNOWN

0 个答案:

没有答案