如何在python3环境中执行scons? [英] How to execute scons in a python3 environment?

查看:145
本文介绍了如何在python3环境中执行scons?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 scons 脚本中导入 python3 脚本.(我使用的是 scons v3.0.1.7)

I need to import python3 scripts within a scons script. (I use scons v3.0.1.7)

有没有办法用 python 3 执行 scons ?

Is there a way to execute scons with python 3 ?

官方 scons 网站说

The offical scons site says

这将是第一个支持早于 2.7 和 3.5+ 的 Python 版本

This will be the first release to support Python versions earlier than 2.7 as well as 3.5+

scons -python/usr/bin/python3 这样的东西最好选择 python 解释器.

Something like scons -python /usr/bin/python3 would be good to select the python interpreter.

我没有找到如何为 python3 构建 scons 版本.

I did not find either how to build a scons version for python3.

推荐答案

在最新版本中,SCons 同时支持 Python2 和 Python3.不需要重新编译 SCons 本身或类似的东西.重要的是哪个 Python 版本是您系统上的默认版本.

In the latest versions, SCons supports both Python2 and Python3. There is no need to recompile SCons itself or such. All that matters is which Python version is the default on your system.

你没有提到你试图在哪个操作系统下运行,所以我现在假设一个 Linux.安装后,您可以在 /usr/local/bin/scons 之类的位置找到 scons 脚本(尝试which scons",如果在怀疑).第一行

You don't mention under which OS you're trying to get this working, so I assume a Linux for now. After the installation you can find the scons script in a location like /usr/local/bin/scons (try "which scons" if in doubt). The first line

#! /usr/bin/env python

告诉您的系统使用默认的 Python 版本.如果这不是您想要的,您可以简单地将其更改为例如

tells your system to use the default Python version. If this is not what you want, you can simply change it to e.g.

#! /usr/bin/env python3

如果您使用的是 Python2-default 系统,但希望使用 Python3 运行 SCons.

if you're under a Python2-default system, but want to run SCons with Python3 instead.

这篇关于如何在python3环境中执行scons?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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