2017-07-31 114 views
0

如何在安装Python 3.6.1和Python 2.7.13时在Windows 10上运行scons?当输入python到我的命令窗口,我得到以下输出:使用Python 2.7和Python 3在Windows 10环境中运行scons

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 

由于我个人使用Python这3.6.x的是对我很好,我不想改变这一点。

当输入py -2到我的命令窗口,我得到以下输出:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 

scons不使用Python 3.x的工作它需要用Python 2.7.x来执行。我如何“告诉”scons使用Python 2.7.x?

当我只需键入scons的进入命令提示符我得到以下输出:

PS C:\dev\projectX> scons 
Fatal Python error: Py_Initialize: unable to load the file system codec 
ModuleNotFoundError: No module named 'encodings' 

Current thread 0x00007050 (most recent call first): 

回答

1

尝试从scons.bat更改行23:

python "%scriptname%" %* 

py -2 "%scriptname%" %* 

注意,在得到SCons的工作,既PY下运行2和3.5 PY +大部分已完成,应在下个月发布(左右)

0

在PowerShell中运行使用SCons之前,修改PATH环境变量,把你的Python 2.7安装在前面。喜欢的东西:

SET PATH=C:\Python27;%path%