从特定的setup.py中进行pip安装 [英] pip install from specific setup.py

查看:165
本文介绍了从特定的setup.py中进行pip安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在RedHat的Openshift云服务上创建了一个python 3.3应用程序.默认情况下,它具有我的项目的setup.py.我正在学习名为使用Flask构建SaaS应用程序"的Udemy课程(源代码),现在我想按照课程的建议使用python-click.对于cli项目,它需要另一个setup.py;为了将该文件放在项目根文件夹中,我将其重命名为 setup_cli.py .现在有两个文件: setup.py setup_cli.py . Pip安装似乎会自动进入setup.py.

I created a python 3.3 app on RedHat's Openshift cloud service. By default it has setup.py for my project. I'm learning Udemy course called "Build a SaaS app with Flask" (source code) Now I wanted to use python-click, as recommended by the course. It needs another setup.py for cli project; so to put that file in the project root folder, I renamed it to setup_cli.py. Now there are two files: setup.py and setup_cli.py. Pip install seems to automatically look into setup.py.

# See Dockerfile in github source
pip install --editable <from setup_cli.py>

可以使用pip install --editable指向setup_cli.py吗?

Can pip install --editable be used to point to setup_cli.py?

推荐答案

似乎您无能为力:-)-它是在pip源代码中硬编码的:-)

It seems that you can't do anything about it :-) - It's hard coded in pip source code :-)

如果尝试使用pip install -e .,它将调用名为 parse_editable ,它将运行这行:

If you try to use pip install -e ., it will call a method named parse_editable which will run this line:

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:-)

You may want to to use this command pip install -e file:///full/path/to/setup_cli.py, but this command also appends a hard coded setup.py to your path :-)

setup_py 中,有行:

setup_py = os.path.join(self.setup_py_dir, 'setup.py')

如@cel所评论,看来python <whatever-setup.py> develop是您唯一的选择.

so as @cel commented, it seems that python <whatever-setup.py> develop is your only option.

这篇关于从特定的setup.py中进行pip安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆