我在一个版本化文件夹中有两个或多个 Python 包:
.
├── .git
├── api
│ ├── mf_hub_api
│ │ └── __init__.py
│ └── setup.py
├── pkg
│ ├── mf_hub
│ │ └── __init__.py
│ └── setup.py
└── README.rst
./api 和 pkg python 包都运行pip install -e .
良好,但pip install .
给我回溯:
mf_hub/pkg$ pip install .
Processing .../mf_hub/pkg
...
LookupError: setuptools-scm was unable to detect version for '/tmp'.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
我的config.py
::
mf_hub$ cat pkg/setup.py
from setuptools import find_packages
from setuptools import setup
requirements = """
pip
setuptools
wheel
setuptools_scm
"""
setup(
name="mf_hub",
setup_requires=["setuptools_scm"],
use_scm_version={
"write_to": "../version.txt",
"root": "..",
"relative_to": __file__,
},
packages=find_packages(),
test_suite="tests",
install_requires=requirements,
include_package_data=True,
zip_safe=False,
)
mf_hub$
什么可能是临时解决方法?
我看到有一个与此相关的未解决问题:https ://github.com/pypa/setuptools_scm/issues/357