博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Python setup.py开发与安装
阅读量:2288 次
发布时间:2019-05-09

本文共 2816 字,大约阅读时间需要 9 分钟。

本文翻译自:

Two options in setup.py develop and install are confusing me. setup.py developinstall中的两个选项使我感到困惑。 According to this , using develop creates a special link to site-packages directory. 根据此 ,使用develop创建到site-packages目录的特殊链接。

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. 人们建议我将python setup.py install用于全新安装,并对设置文件进行任何更改后再使用python setup.py develop

Can anyone shed some light on the usage of these commands? 任何人都可以阐明这些命令的用法吗?


#1楼

参考:


#2楼

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 install用于安装(通常是第三方)您不会自行开发/修改/调试的软件包。

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. 对于您自己的东西,您想先安装您的软件包,然后能够频繁编辑代码不必每次都重新安装软件包-这正是python setup.py develop所做的:它会安装软件包(通常是安装软件包只是一个源文件夹),从而可以在将代码安装到(虚拟)环境后方便地编辑代码,并使更改立即生效。

Note that it is highly recommended to use pip install . 请注意,强烈建议使用pip install . (install) and pip install -e . (安装)和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 . (开发人员安装)以安装软件包,因为直接调用setup.py会对许多依赖项做错事,例如pull prereleases和不兼容的软件包版本,或者使软件包很难用pip卸载。


#3楼

From the . 从 。 The develop will not install the package but it will create a .egg-link in the deployment directory back to the project source code directory. develop将不会安装软件包,但会在部署目录中创建一个.egg-link ,返回到项目源代码目录。

So it's like installing but instead of copying to the site-packages it adds a symbolic link (the .egg-link acts as a multiplatform symbolic link). 因此,这就像安装,而不是复制到site-packages而是添加了符号链接( .egg-link充当多平台符号链接)。

That way you can edit the source code and see the changes directly without having to reinstall every time that you make a little change. 这样,您可以编辑源代码并直接查看更改, 无需在每次进行少量更改时都重新安装。 This is useful when you are the developer of that project hence the name develop . 当您是该项目的开发者时,这很有用,因此名称为develop If you are just installing someone else's package you should use install 如果您只是在安装别人的软件包,则应使用install


#4楼

Another thing that people may find useful when using the develop method is the --user option to install without sudo. 人们使用develop方法时可能会发现有用的另一件事是--user选项,无需使用sudo即可安装。 Ex: 例如:

python setup.py develop --user

instead of 代替

sudo python setup.py develop

转载地址:http://pgcnb.baihongyu.com/

你可能感兴趣的文章
hdu1002——A + B Problem II(大数加)
查看>>
hdu1087——Super Jumping! Jumping! Jumping!(最大递增子序列和)
查看>>
hdu1176——免费馅饼(简单dp)
查看>>
hdu1257——最少拦截系统(贪心)
查看>>
hdu5982——Relic Discovery(水)
查看>>
hdu5984——Pocky(数学期望)
查看>>
poj3186——Treats for the Cows(区间dp)
查看>>
poj3616——Milking Time(dp最大子序列)
查看>>
poj2318——TOYS(计算几何+点与线段的位置)
查看>>
poj2398——Toy Storage(计算几何)
查看>>
poj3304——Segments(判断直线与多个线段相交)
查看>>
poj1269——Intersecting Lines(判断线段交点)
查看>>
poj2653——Pick-up sticks(判断线段是否相交)
查看>>
poj1753——Flip Game(枚举+dfs)
查看>>
poj2965——The Pilots Brothers' refrigerator(模拟)
查看>>
poj2506——Tiling(递推+大数加)
查看>>
poj3295——Tautology(构造法)
查看>>
poj1573——Robot Motion(模拟)
查看>>
poj2485——Highways(最小生成树+prim)
查看>>
poj3083——Children of the Candy Corn(bfs)
查看>>