小编Rya*_*eer的帖子

使用 .pth 文件进行 Python 打包

我有一套一起开发并捆绑到一个分发包中的软件包。

为了便于讨论,我们假设我有充分的理由按以下方式组织我的 python 发行包:

SpanishInqProject/
|---SpanishInq/
|     |- weapons/
|     |   |- __init__.py
|     |   |- fear.py
|     |   |- surprise.py    
|     |- expectations/
|     |   |- __init__.py
|     |   |- noone.py
|     |- characters/
|         |- __init__.py
|         |- biggles.py
|         |- cardinal.py
|- tests/
|- setup.py
|- spanish_inq.pth
Run Code Online (Sandbox Code Playgroud)

spanish_inq.pth我已经添加了要添加SpanishInq到 的路径配置文件sys.path,因此我可以直接导入weapons, .etc 。

我希望能够使用 setuptools 构建轮子并在目录中安装 pip install ,但weapons不创建或命名空间。expectationscharactersSpanishInqSpanishInq

我的设置.py:

  from setuptools import setup, …
Run Code Online (Sandbox Code Playgroud)

python setuptools python-2.7 pth python-packaging

5
推荐指数
1
解决办法
2559
查看次数

标签 统计

pth ×1

python ×1

python-2.7 ×1

python-packaging ×1

setuptools ×1