python命令构建发行版setup.py build vs python-m build

dhxwm5r4  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(645)

我正在学习python打包,根据本指南,构建python分发包的命令似乎是 python3 -m build .
但我还发现,setuptools中的setup.py文件有一个命令行界面:

$ python setup.py --help-commands
Standard commands:
  build             build everything needed to install
  build_py          "build" pure Python modules (copy to build directory)
  build_ext         build C/C++ extensions (compile/link to build directory)
  build_clib        build C/C++ libraries used by Python extensions
  build_scripts     "build" scripts (copy and fixup #! line)
  clean             clean up temporary files from 'build' command
  install           install everything from build directory
  install_lib       install all Python modules (extensions and pure Python)
  install_headers   install C/C++ header files
  install_scripts   install scripts (Python or otherwise)
  install_data      install data files
  sdist             create a source distribution (tarball, zip file, etc.)
  register          register the distribution with the Python package index
  bdist             create a built (binary) distribution
  bdist_dumb        create a "dumb" built distribution
  bdist_rpm         create an RPM distribution
  bdist_wininst     create an executable installer for MS Windows
  check             perform some checks on the package
  upload            upload binary package to PyPI

看来 python setup.py build , sdistbdist 也可以构建发行版,但我没有找到这些命令的详细说明,setuptools命令参考缺乏对这些命令的解释 build sdist bdist .
所以我有点困惑,两者的区别是什么 python setup.py buildpython -m build ,或介于 python setup.py sdistpython -m build --sdist ? 是 python setup.py 命令已弃用,因此缺少完整的文档?我应该什么时候使用 python -m buildpython setup.py build ?
任何帮助都将不胜感激。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题