Python setup.py 开发与安装 [英] Python setup.py develop vs install

查看:52
本文介绍了Python setup.py 开发与安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

setup.py developinstall 中的两个选项让我很困惑.根据这个 site,使用 develop 创建指向站点包目录的特殊链接.

Two options in setup.py develop and install are confusing me. According to this site, using develop creates a special link to site-packages directory.

人们建议我使用 python setup.py install 进行全新安装,并在对安装文件进行任何更改后使用 python setup.py develop.

People have suggested that I use python setup.py install for a fresh installation and python setup.py develop after any changes have been made to the setup file.

谁能解释一下这些命令的用法?

Can anyone shed some light on the usage of these commands?

推荐答案

python setup.py install 用于安装(通常是第三方)您不打算开发/修改/的包自己调试.

python setup.py install is used to install (typically third party) packages that you're not going to develop/modify/debug yourself.

对于你自己的东西,你想先安装你的包,然后能够经常编辑代码而不必每次都重新安装包——这正是 python setup.py develop 这样做:它安装包(通常只是一个源文件夹)的方式允许您在安装到(虚拟)环境后方便地编辑代码,并使更改立即生效.

For your own stuff, you want to first install your package and then be able to frequently edit the code without having to re-install the package every time — and that is exactly what python setup.py develop does: it installs the package (typically just a source folder) in a way that allows you to conveniently edit your code after it’s installed to the (virtual) environment, and have the changes take effect immediately.

请注意,强烈建议使用 pip install .(安装)和 pip install -e .(开发人员安装)来安装软件包,如调用 setup.py 直接会对很多依赖做错误的事情,例如拉取预发布和不兼容的包版本,或者使用 pip 使包难以卸载.

Note that it is highly recommended to use pip install . (install) and pip install -e . (developer install) to install packages, as invoking setup.py directly will do the wrong things for many dependencies, such as pull prereleases and incompatible package versions, or make the package hard to uninstall with pip.

这篇关于Python setup.py 开发与安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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