【发布时间】:2016-08-10 17:13:28
【问题描述】:
我正在尝试为我正在编写的 pip 库运行一些预安装命令。我的设置文件如下所示:
from setuptools import setup
from setuptools.command.install import install
class CustomInstall(install):
def run(self):
install.run(self)
print "TEST"
setup(
...
cmdclass={'install': CustomInstall},
...)
基于Run custom task when call `pip install`。
但是,pip 安装不会打印“TEST”。我在这里做错了什么吗?我怎样才能让这个 setup.py 文件真正打印出来?
更新:以下内容,仅供参考,确实会引发属性错误:
from setuptools import setup
from setuptools.command.install import install
class CustomInstall(install):
def run(self):
install.run(self)
raise AttributeError
setup(
...
cmdclass={'install': CustomInstall},
...)
【问题讨论】:
-
我在这里回答了这个问题:stackoverflow.com/questions/15853058/…