草庐IT

login-required

全部标签

python - 如何使用 pip requirements.txt 文件安装 python 模块附加功能

piprequirements.txtdocumentation说可以使用像这样的行安装附加功能MyPackage==3.0[PDF]所以在我的requirements.txt文件中有一行内容如下:requests==2.9.1[security]但是当我运行命令时,没有为请求模块安装安全附加功能:pipinstall-rrequirements.txt我收到一条错误消息,提示我的文件格式不正确:Invalidrequirement:'requests==2.9.1[security]'Traceback(mostrecentcalllast):File"/Library/Python

python - "an integer is required"以 utf-8 格式打开()文件时?

我有一个文件,我想用以下行在python中打开:f=open("C:/data/lastfm-dataset-360k/test_data.tsv","r","utf-8")调用这个给我错误TypeError:anintegerisrequired我删除了除该行之外的所有其他代码,但仍然出现错误。我做错了什么以及如何正确打开它? 最佳答案 来自open()的文档:open(name[,mode[,buffering]])[...]Theoptionalbufferingargumentspecifiesthefile’sdesire

Python 的 AttributeError : 'module' object has no attribute 'require_version'

我正在使用Python3.4。我正在尝试打开一个应用程序,该应用程序据称使用Python但似乎无法使其正常工作。我确实收到以下错误:Traceback(mostrecentcalllast):File"pychess",line24,ingi.require_version("Gtk","3.0")AttributeError:'module'objecthasnoattribute'require_version' 最佳答案 按照JoãoCartucho的建议,使用pipinstallPyGTK安装依赖项。

python - Flask-Login 的 request_loader 与 user_loader 有什么关系?

我提前为提出一个相当神秘的问题道歉。但是,尽管查阅了很多Material,我还是不明白。如果您能阐明这一点,那就太好了。flask-login中的request_loader的作用是什么?它如何与user_loader装饰器交互?如果我使用基于token的身份验证系统(我计划将token发送到我的angularJS前端,将token存储在那里并将该token发送到授权tokenheader中),我需要一个request_loader还是一个user_loader(我在其中检查身份验证header并查看用户是否存在)是否足够? 最佳答案

python - django 1.10 在解析模板 'is_popup' 中的变量 'admin/login.html' 时出现异常

我用python3.5和django1.10.0创建了一个新的django项目,每当我想访问localhost:8000/admin时,我总是在管理中收到错误,这是错误:[DEBUG]-Exceptionwhileresolvingvariable'is_popup'intemplate'admin/login.html'.Traceback(mostrecentcalllast):File"C:\Python\Python35\lib\site-packages\django\template\base.py",line885,in_resolve_lookupcurrent=cur

python - Linux Python Azure Function APP - 尽管在 requirements.txt 和其他模块中工作正常,但找不到 pyodbc 模块

我正在使用Linux消费计划。我收到以下错误;异常:ModuleNotFoundError:没有名为“pyodbc”的模块我在requirements.txt文件中添加了pyodbc并且此文件中的其他模块(例如azure-storage)工作正常。有没有人见过这个问题或可以确认这是一个已知错误?我看不到任何手动安装它的方法。 最佳答案 我认为这是Pythonworker的一个错误。因为我也有这个问题,所以我已经向团队提出了一个问题。https://github.com/Azure/azure-functions-python-wor

python - pip3 setup.py install_requires PEP 508 私有(private)仓库的 git URL

我正在尝试运行:pip3install-e.在我的Python项目中,我有以下setup.py:fromsetuptoolsimportsetupsetup(name='mypackage',install_requires=["anotherpackage@git+git@bitbucket.org:myorg/anotherpackage.git"])但它失败了:errorinmypackagesetupcommand:'install_requires'mustbeastringorlistofstringscontainingvalidproject/versionrequir

python - 导入错误 : Missing required dependencies ['numpy' ]

我能够成功运行所有使用pandas的脚本,但突然我所有的PANDASSCRIPTS都给出了这个错误:追溯(最近的调用最后):文件“data_visulaization.py”,第5行,在importpandasaspdFile"/usr/lib64/python2.7/site-packages/pandas/init.py",line18,inraiseImportError("Missingrequireddependencies{0}".format(missing_dependencies))ImportError:Missingrequireddependencies['nu

python - 带有 URL 的 pip -U -r requirements.txt 不断重新安装

我正在使用Django的测试版,下载页面建议使用URL。requirements.txt条目只是URL:https://www.djangoproject.com/download/1.7b3/tarball/当我运行pipinstall-U-rrequirements.txt时,它总是会重新安装Django。有没有办法在requirements.txt行中指定版本,例如...tarball/#egg=Django==1.7b3?我喜欢在开发时每个包都是最新版本,所以我使用-U。也许有更好的解决方法? 最佳答案 您应该尝试将这些行之

python - 如何在 requirements.txt 中允许未经验证的包

在服务器上安装ahocorasick时出现以下错误:一些不安全和无法验证的文件被忽略(使用--allow-unverifiedahocorasick允许)。如何修改requirements.txt以允许未验证的包?FreshdeployonHerokufailswith"use--allow-unverifiedPILtoallow"中的答案说明我们可以在requirements.txt中添加--allow-unverifiedahocorasick。但这对我不起作用。 最佳答案 您还需要在requirements.txt的顶部添加