草庐IT

require_dependency

全部标签

python - 在 Django 中,如何将 "This field is required."更改为 "Name is required"?

我正在使用表单框架。当我设置required=True时,会显示此错误。如果我不想让它说“这个字段”,而是说标签呢?因为我不会在表单输入下方显示它。我将在页面顶部显示所有错误。 最佳答案 指定简单“必需”验证消息的一种简单方法是向字段传递error_messages参数。name=forms.CharField(error_messages={'required':'YourNameisRequired'})检查可以为每个字段指定键的文档:http://docs.djangoproject.com/en/dev/ref/forms/

python - 尽管安装了 GEOS,但获取 "django.core.exceptions.ImproperlyConfigured: GEOS is required and has not been detected."

我在Ubuntu14.04LTS上运行Django1.8和Python3.4。就在最近,我的Django应用一直在报告GEOS不存在。GEOS已安装并且libgeos_c.so位于它应该位于的位置(/usr/lib/)。我的代码看起来不错。它是仍然有效的docker镜像的来源。这似乎表明操作系统/不兼容问题。任何帮助将不胜感激。完整的追溯是Traceback(mostrecentcalllast):File"/pycharm-4.5.1/helpers/pydev/pydevd.py",line2358,inglobals=debugger.run(setup['file'],None

python - 如何创建requirements.txt?

这个问题在这里已经有了答案:Automaticallycreaterequirements.txt(23个回答)关闭4年前。我想知道如何为我的Python3应用程序创建合适的requirements.txt?

python - 设置.py & pip : override one of the dependency's sub-dependency from requirements. txt

我目前正在开发一个包,在我的requirements.txt中,我有一个依赖项:wikipedia。现在,wikipedia1.3使用requests-2.2.1而我的包使用版本2.3.0。此外,正如人们所预料的那样,wikipedia-1.3的安装取决于它是否存在依赖项。但是,如果我启动一个新的virtualenv并直接将wikipedia包含在我的requirements.txt中,它会在上给出一个ImportErrorrequests因为在setup.py运行时,requests-2.3.0的setup.py不会执行,除非所有其他人执行。在下面的附图中,解压后没有运行setup.

python - 批量删除联系人报 "If-Match or If-None-Match header or entry etag attribute required"错误

我正在使用gdataPython库来批量删除联系人,但我只是收到“需要If-Match或If-None-Matchheader或条目etag属性”错误。我认为当我必须在控制台中启用ContactsAPI时问题就开始了(直到几天前还不需要?*)。编辑:更新和删除操作实际上都失败了。批量插入工作正常。尝试指定If-Matchheader,但仍然失败:custom_headers=atom.client.CustomHeaders(**{'If-Match':'*'})request_feed=gdata.contacts.data.ContactsFeed()request_feed.Ad

python - 为什么 setup_requires 不能为 numpy 正常工作?

我想创建一个setup.py文件来自动解析对numpy的构建时依赖性(用于编译扩展)。我的第一个猜测是使用setup_requires和子类命令类来导入numpy模块:fromsetuptoolsimportsetup,Extensionfromdistutils.command.buildimportbuildas_buildclassbuild(_build):defrun(self):importnumpyprint(numpy.get_include())_build.run(self)setup(name='test',version='0.0',description='s

python - Python依赖 hell : A compromise between virtualenv and global dependencies?

到目前为止,我已经测试了多种方法来用在Python中管理我的项目依赖项:使用pip全局安装所有内容(节省空间,但迟早会给您带来麻烦)pip和venv或virtualenv(管理起来有点麻烦,但在许多情况下还可以)pipenv和pipfile(比venv/virtualenv容易一些,但速度较慢,并且有一些供应商锁定,虚拟环境隐藏在实际项目文件夹之外的其他位置)conda作为程序包和环境管理器(最好在conda中提供所有程序包,将pip和conda混合使用会有点麻烦)诗歌-我还没有尝试过这个...我所有这些问题(除了1.)的问题是我的硬盘空间很快就被填满了:我不是开发人员,我在日常工作中

python - 当 requirements.txt 或 setup.py 改变时用 tox 重新安装 virtualenv

以前我手动使用看起来像这样的Makefile:.PHONY:allall:tests.PHONY:teststests:py_envbash-c'sourcepy_env/bin/activate&&py.testtests'py_env:requirements_dev.txtsetup.pyrm-rfpy_envvirtualenvpy_envbash-c'sourcepy_env/bin/activate&&pipinstall-rrequirements_dev.txt'这有很好的副作用,如果我更改requirements_dev.txt或setup.py,它会重建我的virt

python 3.5 -> 3.6 Tablib TypeError : cell() missing 1 required positional argument: 'column'

从python3.5迁移到3.6,我的单元测试揭示了django-import-export和tablib的问题:TypeError:cell()missing1requiredpositionalargument:'column'File"/lib/python3.6/site-packages/tablib/formats/_xlsx.py",line122,indset_sheetcell=ws.cell('%s%s'%(col_idx,row_number))TypeError:cell()missing1requiredpositionalargument:'column't

python 没有安装 setuptools 的 install_requires 中列出的依赖项

我写了一个依赖openpyxl的python模块。我希望使用setuptools将openpxyl作为依赖项自动安装。我读到正确的方法是在setup.py脚本中包含以下内容:setup(name='methpipe',version=find_version("lala","__init__.py"),description='Utilities',author='JonathanT',author_email='jt@lala.com',url='https://git.com...',packages=find_packages(),install_requires=['openp