buildout-使用不同的python版本 [英] buildout - using different python version

查看:144
本文介绍了buildout-使用不同的python版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了必须在旧计算机上运行的扩展项目(具体来说是django),它在使用python 2.7的本地系统中运行良好.

i have set up buildout project (django to be specific) that has to run in old machine, it works fine in my local system with python 2.7.

在生产服务器中,它运行python 2.5,我想配置将下载并使用2.6的扩展,但仅此项目不在系统范围内.

In production server it runs python 2.5 and i want to configure buildout that it would download and use 2.6, but only this project not system wide.

所以我认为它应该使用某种配方,但是女巫又如何?我找不到一个.我希望仅使用buildout.cfg文件即可实现..

So i assume it should use some sort of recipe, but witch and how? I cannot find one. I hope to achieve it only using buildout.cfg file..

推荐答案

Buildout特别支持这种情况.扩展中的每个部分都可以使用其自己的python解释器,或者您可以为所有部分全局设置一个python解释器.默认为用于运行buildout的python.

Buildout specifically supports this scenario. Each part in a buildout can use it's own python interpreter, or you can set one python interpreter globally for all parts. This defaults to the python used to run buildout.

要设置使用的python解释器,请将python选项设置为包含executable选项的零件的名称.这可以是构建全新的python解释器的一部分.这是一个示例:

To set the python interpreter used, set the python option to the name of a part that contains an executable option. This can be a part that builds a whole new python interpreter. Here is an example:

[buildout]
python = python
parts =
    python

[python]
recipe = zc.recipe.cmmi
url = http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
executable = ${buildout:directory}/parts/python/bin/python2.6
extra_options=
    --enable-unicode=ucs4
    --with-threads
    --with-readline

此扩展的其他任何部分现在都将使用python 2.6可执行文件.

Any other parts in this buildout now will use the python 2.6 executable.

您可能还希望将python脚本符号链接到buildout bin/目录中.以下部分将为您做到这一点:

You may want to symlink the python script into the buildout bin/ directory as well; the following part would do that for you:

[pythonbin]
recipe = plone.recipe.command
command = ln -s ${python:executable} ${buildout:bin-directory}/python

这篇关于buildout-使用不同的python版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆