草庐IT

login-required

全部标签

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.

python - requirements.txt 取决于 python 版本

我正在尝试使用六个将python2包移植到python3(不是我自己的),以便它与两者兼容。但是,requirements.txt中列出的软件包之一现在包含在python3标准库中,并且pypi版本在python3中不起作用,所以我想有条件地排除它。在setup.py中执行此操作很简单,我可以执行以下操作:ifsys.version_info[0]==2:requirements+=py2_requirementselse:requirements+=py3_requirements但我希望requirements.txt也能反射(reflect)正确的列表。我在pip文档中找不到任何

python - 如何为多个环境自定义 requirements.txt?

我有两个分支,开发和生产。每个都有依赖关系,其中一些是不同的。Development指向本身正在开发中的依赖项。对于生产也是如此。我需要部署到Heroku,它期望每个分支的依赖项都在一个名为“requirements.txt”的文件中。最好的组织方式是什么?我的想法:维护单独的需求文件,每个分支一个(必须经受住频繁的合并!)告诉Heroku我要使用哪个需求文件(环境变量?)编写部署脚本(创建临时分支、修改需求文件、提交、部署、删除临时分支) 最佳答案 您可以级联您的需求文件并使用“-r”标志告诉pip将一个文件的内容包含在另一个文件

python - 何时在 setup.py 中使用 pip 需求文件与 install_requires?

我正在使用pip和virtualenv来打包和安装一些Python库。我想我正在做的是一个很常见的场景。我是几个库的维护者,我可以为其明确指定依赖项。我的一些库依赖于我无法控制的具有传递依赖关系的第三方库。我想要实现的是pipinstall在我的一个库上下载/安装其所有上游依赖项。我在pip文档中苦苦挣扎的是if/howrequirementsfiles可以自己执行此操作,或者如果它们真的只是使用install_requires的补充。我是否会在我的所有库中使用install_requires来指定依赖项和版本范围,然后只使用需求文件来解决冲突和/或卡住它们以用于生产构建?假设我生活在

python - 使用 requirements.txt 安装时,阻止 pip 在单个包上失败

我正在从requirements.txt安装软件包pipinstall-rrequirements.txtrequirements.txt文件内容如下:Pillowlxmlcssselectjiebabeautifulsoupnltklxml是唯一无法安装的软件包,这会导致一切都失败(larsks在评论中指出的预期结果)。但是,在lxml失败后,pip仍然会运行并下载其余的包。据我了解,如果requirements.txt中列出的任何软件包安装失败,pipinstall-rrequirements.txt命令将失败。在运行pipinstall-rrequirements.txt时我可以