【发布时间】:2017-11-16 21:22:48
【问题描述】:
请在标记为重复之前,我已经尝试了一堆解决方案 包括一个here 但没有运气
我已经创建了一个简单的工具来完成一些任务并且能够成功打包它。
当我尝试安装它时,当我使用python setup.py install 时,我得到了想要的效果,但pip install package_name 只是安装了包,但没有安装后脚本。
这是我的部分代码;
setup.py
from distutils import setup
from app.scripts import *
setup(
#Application name
name = "my-app-name",
version = "my-app-version",
author = "my-name",
author_email = "my-email",
packages = ['app'],
include_package_data = True,
license = 'MIT',
url = "https://my-url",
description = "description",
install_requires = ["flake8"],
cmdclass = {
"install":Post_install
}
)
scripts.py
from distutils.command.install import install
import os
class Post_install(install):
@staticmethod
def func():
return True
def run(self):
install.run(self)
#Pre install actions
if Post_install.func():
print("Bingo")
else:
print("Failed")
谢谢:)
PS我在上传包后运行pip install。
【问题讨论】:
-
您是否有可能安装的是较早版本的库? pip 服务器更新需要一段时间吗?
-
这很难说,因为你已经剥离了某些细节的代码。
-
@SwiftsNamesake 我已经验证了我正在安装的库的版本,它是正确的,我很确定
标签: python python-3.x setuptools distutils python-packaging