使用setuptools更改默认的dist文件夹 [英] Change default dist folder with setuptools

查看:119
本文介绍了使用setuptools更改默认的dist文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用setuptools 0.6打包我的代码.默认情况下,当我键入python setup.py sdist时,该工具直接在脚本的同一文件夹中创建一个文件夹dist.我该怎么做才能更改此默认文件夹? 另一个问题是,如果我的安装脚本和程序包文件夹不在同一文件夹中,该怎么做才能指定程序包的确切路径? 谢谢

I'm using setuptools 0.6 to package my code. By default when I type python setup.py sdist, the tool creates a folder dist directly in the same folder of my script. What I can do to change this default folder? Another question is, if my setup script and my package folder are not in the same folder, what can I do to specify the exact path of the package? Thanks

推荐答案

使用--dist-dir=[differentdir]选项.来自python setup.py sdist --help:

  --dist-dir (-d)   directory to put the source distribution archive(s) in
                    [default: dist]

您可以使用setup()package_dir关键字参数指定顶级软件包目录:

You can specify the top-level package directory with the package_dir keyword argument to setup():

package_dir = {'': 'src'},

我可以推荐 Python打包用户指南,以获取有关如何打包您的软件包的很好的教程python项目.

I can recommend the Python Packaging User Guide for a good tutorial on how to package your python projects.

这篇关于使用setuptools更改默认的dist文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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