草庐IT

piecewise_constant_distribution

全部标签

python - pip(或 setuptools、distribute 等)可以列出每个已安装软件包使用的许可证吗?

我正在尝试审核具有大量依赖项的Python项目,虽然我可以手动查找每个项目的主页/许可条款,但似乎大多数OSS包应该已经在其元数据中包含许可名称和版本。不幸的是,我在pip或easy_install中找不到任何选项来列出包名称和安装版本(通过pipfreeze)。有没有人提供一个工具来列出Python包的许可证元数据? 最佳答案 这是一个可复制粘贴的片段,可以打印您的包裹。需要:漂亮的(pipinstallprettytable)代码importpkg_resourcesimportprettytabledefget_pkg_lic

python - pip 是否处理来自 setuptools/distribute 来源的 extras_requires?

我有一个带有setup.py和extras_requires的包“A”行如:extras_require={'ssh':['paramiko'],},还有一个依赖于util的包“B”:install_requires=['A[ssh]']如果我在包B上运行pythonsetup.pyinstall,它在后台使用setuptools.command.easy_install,则extras_requires是正确解析,并且安装了paramiko。但是,如果我运行pip/path/to/B或piphxxp://.../b-version.tar.gz,包A是已安装,但paramiko未安装

python - 错误信息 "python-pylint ' C0103 :Invalid constant name"

我对这张照片中的错误感到困惑:我不知道如何解决它们。我的程序是Python-Flask网络框架。当我使用VisualStudioCode调试我的程序时,Pylint会显示这些错误。我知道这个问题无关紧要,但它让我很恼火。我该如何解决?#-*-coding:utf-8-*-importsysfromflaskimportFlaskfromflask_bootstrapimportBootstrapfromflask_momentimportMoment#fromflask_wtfimportForm#fromwtformsimportStringField,SubmitField#fro

python - 如何在 install_requires 中指定版本范围(setuptools、distribute)

我想制作一个依赖于特定版本范围的包,例如>=0.5.0,.install_requires有可能吗?选项,如果是的话应该怎么做? 最佳答案 根据thedocumentation,您的语法应该可以正常工作。该文档指出:setuptoolsandpkg_resourcesuseacommonsyntaxforspecifyingaproject'srequireddependencies.Thissyntaxconsistsofaproject'sPyPIname,optionallyfollowedbyacomma-separated

python - Easy_install 和 pip 坏了 : pkg_resources. DistributionNotFound : distribute==0. 6.36

我曾尝试在OSX上使用pipinstall--upgradepip升级pip,而pip和easy_install都不起作用。运行pip时Traceback(mostrecentcalllast):File"/usr/local/bin/pip",line5,infrompkg_resourcesimportload_entry_pointFile"/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2

java - A Switch Java 问题 : case expressions must be constant expressions

我的switch/case语句有问题。错误说:“案例表达式必须是常量表达式”。我理解错误,我可以使用If解决它,但有人可以告诉我为什么case表达式必须在switch/case中保持不变。我的错误代码示例:publicbooleanonOptionsItemSelected(MenuItemitem){intidDirectory=((MenuItem)findViewById(R.id.createDirectory)).getItemId();intidSuppression=((MenuItem)findViewById(R.id.recycleTrash)).getItemId

Java Spring : Error message "no declaration can be found for element ' util:constant'

我正在尝试将util-constant用于ioc,但收到以下错误消息:cvc-complex-type.2.4.c:Thematchingwildcardisstrict,butnodeclarationcanbefoundforelement'util:constant'.Allofthespring3.1.1distjarsareinmyclasspathandIwasabletosuccessfullyrunmyprogrampriortomakingthechangesthatincludedtheuseoftheutil:constanttag.Here'smyiocxmlf

kotlin - kotlin中的java静态最终: Const 'val' initializer should be a constant value

在Java中,我们可以这样做:publicclassTestA{publicstaticfinalbooleanflag=true;publicstaticfinalStringstr=flag?"A":"B";//ok}但在Kotlin中不能classTestA{companionobject{constvalflag=trueconstvalstr=if(flag)"A"else"B"//err:Const'val'initializershouldbeaconstantvaluevalstr2=if(flag)"A"else"B"//ok,butnotequals[publics

c++ - 为什么会这样编译?期待 "cannot assign a constant to a non-const reference"

面试官给我看了这样的代码,问我是否可以编译,并给出我的推理。我非常肯定地告诉他它不会编译,因为10是一个常量,你不能将一个常量分配给一个非常量引用(比如int&b=10不会编译),而且,_a是一个临时变量,它也是再次考虑const,您不能使用非const引用来引用const变量。然而,当我回到家后,我惊讶地发现它可以完美地与所有可能的编译器一起编译。另外,我没有得到这份工作。我的哪一部分理解错了?classA{int&a;public:A(int_a):a(_a){}};intmain(){Aa(10);} 最佳答案 此代码没有“分

c++ - uniform_real_distribution 不统一

请帮助我理解这一点。运行代码段后:random_devicerandomEngine;mt19937generatorEngine(randomEngine());uniform_real_distributionunifRandomValue(numeric_limits::min(),numeric_limits::max());doubletest[1000];for(inti{0};i为什么每个生成的值都在[1.0E306,1.8E308]范围内?我期待一个从接近0到double类型的最大值均匀分布的随机值。提前致谢!这是一个更完整的例子:constsize_tsize{100