我在 RedHat 的 Openshift 云服务上创建了一个 python 3.3 应用程序。默认情况下,它有我的项目的 setup.py 。我正在学习名为“使用 Flask 构建 SaaS 应用程序”的 Udemy 课程(源代码 https://github.com/nickjj/build-a-saas-app-with-flask)现在我想使用 python-click,正如课程推荐的那样。 cli项目需要另一个setup.py;因此,为了将该文件放在项目根文件夹中,我将其重命名为setup_cli.py。现在有两个文件:setup.py and setup_cli.py。
Pip install 似乎会自动查看 setup.py。
# See Dockerfile in github source
pip install --editable <from setup_cli.py>
Can pip install --editable
用于指向 setup_cli.py?
看来你对此无能为力:-) - 它是硬编码在 pip 源代码中:-)
如果您尝试使用pip install -e .
,它将调用一个名为的方法解析可编辑 https://github.com/pypa/pip/blob/master/pip/req/req_install.py#L1115它将运行这条线 https://github.com/pypa/pip/blob/6ec55979300c836e35c2ac1b99bc1c78d96baef2/pip/req/req_install.py#L1010:
if not os.path.exists(os.path.join(url_no_extras, 'setup.py')):
raise InstallationError(
"Directory %r is not installable. File 'setup.py' not found." %
url_no_extras
)
您可能想使用此命令pip install -e file:///full/path/to/setup_cli.py
,但是这个命令还附加了一个硬编码setup.py
走向你的道路:-)
In setup_py https://github.com/pypa/pip/blob/master/pip/req/req_install.py#L372有this https://github.com/pypa/pip/blob/master/pip/req/req_install.py#L387 line:
setup_py = os.path.join(self.setup_py_dir, 'setup.py')
正如@cel 评论的那样,似乎python <whatever-setup.py> develop
是你唯一的选择。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)