草庐IT

user_setup

全部标签

Python:将 setup.py "scripts="迁移到 entry_points

我想使用其他人的python实用程序,foobartools,它的native环境是linux。Foobartools是纯python,因此没有理由不能在我所在的Windows上使用它。在他们的setup.py中,他们使用旧式scripts=['bin/foobar'],。运行pipinstall-eb:\code\foobar在%pythonhome%\Scripts中创建一个名为foobar的文件,但Windows不会即使Scripts在PATH中,也不知道它。要使用它,我需要创建一个@python%pythonhome%\scripts\foobar批处理文件。这可行但不是最佳的

python - 如何为pytest设置current_user?

我正在为在查询中使用当前登录用户的View编写单元测试:@app.route('/vendors/create',methods=['GET','POST'])@login_requireddefcreate_vendors():vendor_form=VendorForm(request.form)ifvendor_form.validate_on_submit():vendor=db.session.query(Vendors).filter(Vendors.name==vendor_form.name.data,Vendors.users.contains(g.user)).fi

python - 在 setup.py 脚本中安装 nltk 数据依赖

我在我的项目中使用NLTK和wordnet。我在我的PC上使用pip手动安装:pip3installnltk--user在终端中,然后nltk.download()在pythonshell中下载wordnet。我想用setup.py文件自动化这些,但我不知道安装wordnet的好方法。目前,我在调用setup之后有这段代码("nltk"在install_requires列表中调用setup):importsysif'install'insys.argv:importnltknltk.download("wordnet")有更好的方法吗? 最佳答案

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 - wxpython的easy_install出现 "setup script"错误

我安装了python2.5,fink放在/sw/bin/中。我使用简易安装命令sudo/sw/bin/easy_installwxPython尝试安装wxpython,但在尝试处理wxPython-src-2.8.9.1.tab.bz2时出现错误,提示没有安装脚本。在此之前,Easy-install已用于其他几种安装。对它为什么现在崩溃有什么帮助吗?编辑:错误发生在转储回shell提示符之前。阅读http://wxPython.org/download.php最佳匹配:wxPythonsrc-2.8.9.1下载中http://downloads.sourceforge.net/wxpy

python - `python setup.py check` 实际上是做什么的?

pythonsetup.pycheck到底做了什么? 最佳答案 第一站,distutilspackagedocumentation:Thecheckcommandperformssometestsonthemeta-dataofapackage.Forexample,itverifiesthatallrequiredmeta-dataareprovidedastheargumentspassedtothesetup()function.因此它会测试您是否正确填写了元数据;在创建Python包时将其视为质量控制步骤。接下来,我们可以检

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 - 不能在 jinja2 宏中使用 current_user?

我使用Flask-Login,它在模板中提供了current_user对象。我想编写一个宏来根据用户是否登录来显示评论表单或登录链接。如果我直接在模板中使用此代码,它会起作用:{%ifcurrent_user.is_authenticated%}{{quick_form(form)}}{%else%}LogInwithGithub{%endif%}我将相同的代码放在一个宏中,然后将宏导入到我的模板中。{%macrocomment_form(form)%}{%ifcurrent_user.is_authenticated%}...{%endif%}{%endmacro%}{%from"m

python - Django LiveServer测试用例 : User created in in setUpClass method not available in test_method?

我正在使用Django1.4的LiveServerTestCase进行Selenium测试,但在使用setUpClass类方法时遇到了问题。据我了解,MembershipTests.setUpClass在单元测试运行之前运行一次。我已经将代码添加到MembershipTests.setUpClass中的数据库,但是当我运行MembershipTests.test_signup测试时,没有用户被添加到测试中数据库。我做错了什么?我希望我在setUpClass中创建的用户在所有单元测试中都可用。如果我将用户创建代码放入MembershipTests.setUp并运行MembershipTe

python - 类型错误 : 'bool' object is not callable g. user.is_authenticated()

这个问题在这里已经有了答案:Flask-LoginraisesTypeError:'bool'objectisnotcallablewhentryingtooverrideis_activeproperty(2个答案)关闭7年前。我正在尝试在我的Flask应用程序中执行此操作。但是我收到这样的错误TypeError:'bool'objectisnotcallable.对应的代码如下:@app.before_requestdefbefore_request():g.user=current_userifg.user.is_authenticated():g.search_form=Non