草庐IT

extras_require

全部标签

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 应用程序提供条件 requirements.txt 文件?

我编写了一个Python应用程序,它与Linux和Windows平台都兼容。但是有一个问题......我需要用于Windows的python包之一与Linux不兼容。幸运的是,还有另一个包可以在Linux上提供相同的功能。所有其他依赖项在两个平台上都兼容。我知道我可以有2个单独的需求文件来分别解决两个平台依赖项。像win_requirements.txt和linux_requirements.txt这样的东西,但是这种方法感觉不是最好的方法。我想知道是否有一种方法可以让我只有一个requirements.txt文件,这样任何用户都可以使用pipinstall-rrequirements

python - 安装一个包并使用 pip 写入 requirements.txt

我正在寻找一种使用pip安装包的方法,并将该包的版本信息写入我项目的requirements.txt文件。对于那些熟悉npm,它本质上就是npminstall--save所做的。使用pipfreeze>requirements.txt效果很好,但我发现我忘记运行它,或者我可能不小心包含了我为测试而安装但决定不使用的未使用包使用。所以下面的伪代码:$pipinstallnose2--save会产生一个requirements.txt文件,其中包含:nose2==0.4.7我想我可以调整save的输出来获取版本号,但我希望有更简单的方法。 最佳答案

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

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

python - 通过 pip : this package requires Python 3. 3 或更高版本为 python 2.7 安装 py2exe

>>>python-c"importsys;printsys.version"2.7.6(default,Nov102013,19:24:18)[MSCv.150032bit(Intel)]>>>pip--versionpip1.5.5fromC:\Python27\lib\site-packages(python2.7)>>>pipinstallpy2exeRuntimeError:ThispackagerequiresPython3.3orlater虽然是官方的py2exedownloadpage说他们有我需要的东西:那么如何通过pip安装py2exe?

python - 类型错误 : a bytes-like object is required, 不是 'str'

以下是尝试使用套接字修改用户提供的输入的代码:fromsocketimport*serverName='127.0.0.1'serverPort=12000clientSocket=socket(AF_INET,SOCK_DGRAM)message=input('Inputlowercasesentence:')clientSocket.sendto(message,(serverName,serverPort))modifiedMessage,serverAddress=clientSocket.recvfrom(2048)print(modifiedMessage)clientSo

python - 将 conda environment.yml 与 pip requirements.txt 相结合

我使用conda环境,也需要一些pip包,例如来自~gohlke的预编译轮子.目前我有两个文件:environment.ymlforcondawith:#run:condaenvcreate--fileenvironment.ymlname:test-envdependencies:-python>=3.5-anaconda和requirements.txt为pip,激活上述conda环境后即可使用:#run:pipinstall-irequirements.txtdocxgooeyhttp://www.lfd.uci.edu/~gohlke/pythonlibs/bofhrmxk/o

python - requirements.txt 与 setup.py

我开始使用Python。我已将requirements.txt和setup.py添加到我的项目中。但是,我仍然对这两个文件的目的感到困惑。我读过setup.py是为可再发行的东西而设计的,而requirements.txt是为不可再发行的东西而设计的。但我不确定这是否准确。这两个文件的真正用途是什么? 最佳答案 requirements.txt:这可以帮助您设置开发环境。pip之类的程序可用于一举安装文件中列出的所有软件包。之后,您可以开始开发您的python脚本。如果您计划让其他人参与开发或使用虚拟环境,则特别有用。这就是你使用它

Python 安装工具 : How can I list a private repository under install_requires?

我正在创建一个setup.py依赖于私有(private)GitHub存储库的项目的文件。文件的相关部分如下所示:fromsetuptoolsimportsetupsetup(name='my_project',...,install_requires=['public_package','other_public_package','private_repo_1','private_repo_2',],dependency_links=['https://github.com/my_account/private_repo_1/master/tarball/','https://gi

python - 仅使用 "conda install --yes --file requirements.txt"安装可用的软件包而不会出错

通过以下命令使用Conda在requirements.txt中安装包时condainstall--yes--filerequirements.txt如果requirements.txt中的包不可用,则会引发“无包错误”,如下所示:UsingAnacondaCloudapisitehttps://api.anaconda.orgFetchingpackagemetadata:....Error:Nopackagesfoundincurrentlinux-64channelsmatching:nimfa==1.2.3Youcansearchforthispackageonanaconda.