Vee*_*dra 9 pip setuptools pypi python-3.x python-wheel
我的项目树结构
\n\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 example.gif\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 funmotd\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 config.json\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 quotes_db.py\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 LICENSE\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 README.md\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 setup.py\n\nRun Code Online (Sandbox Code Playgroud)\n\nsetup.py(为了减少代码量,删除了一些代码)
import sys\nimport os\nimport setuptools\nfrom setuptools.command.install import install\n\nclass PostInstall(install):\n def run(self):\n mode = 0o666\n bashrc_file = os.path.join(os.path.expanduser(\'~\'), ".bashrc")\n install.run(self)\n # Added CLI to .bashrc\n # Change "config.json" file permission\n\n\nsetuptools.setup(\n ...\n entry_points={\'console_scripts\': [\'funmotd = funmotd:main\']},\n package_dir={\'funmotd\': \'funmotd/\'},\n package_data={\'funmotd\': [\'config.json\'], },\n include_package_data=True,\n python_requires=">=3.4",\n cmdclass={\'install\': PostInstall, },\n ... \n)\n\nRun Code Online (Sandbox Code Playgroud)\n\nPostInstall当我运行时,执行得很好python3 setup.py install。因此,上传到Pypi如下(来自此文档)
$ python3 setup.py bdist_wheel\n# Created "dist", "funmotd.egg-info" and "build" dirs\n$ twine upload dist/*\nRun Code Online (Sandbox Code Playgroud)\n\n但是当我运行pip install funmotd,PostInstall不执行时,我发现这dist/*就像静态编译的东西。\n当我运行pip install funmotd. 或者如何使setup.py执行 at pip.
我遵循了以下问题,但没有得到我需要的解决方案
\n\n\n\nPS:我不希望用户克隆存储库并运行python setup.py install. 想让事情变得简单pip install funmotd
UDP日期1
\n\n似乎github 上已经有一个很长的问题了
\npip不是从轮子运行,因此您不能从轮子setup.py运行任何安装后代码。setup.py
setup.py用于构建轮子或在安装源分发(sdist)期间使用。因此,如果您希望安装后脚本停止将轮子上传到 PyPI,只需发布源代码分发版 ( python3 setup.py sdist)。然后pip install funmotd将从 运行代码setup.py。
| 归档时间: |
|
| 查看次数: |
1770 次 |
| 最近记录: |