我一直在研究一些 makefile,它们调用一些 python 脚本来执行各种任务。到目前为止,我一直在make安装了 Ubuntu 16.04(64 位)的机器上运行。今天,我尝试使用相同的 makefile 在我的旧 32 位机器上使用 Lubuntu 16.04 进行构建,但在调用 Python 脚本时失败。
起初,我以为我的Python版本不够新,但我也安装了Python 3.5,并且我将python3makefile中的行更改为,但仍然失败:
python3 /home/morane/Documents/Programming/ConnectX/cxPythonTools/RunUnitTests.py -t /home/morane/bin/tests/unit/cxUnitTests.out -l /home/morane/bin/tests/unit/log/unitTests.log
Traceback (most recent call last):
File "/home/morane/RunUnitTests.py", line 41, in <module>
from subprocess import CREATE_NEW_CONSOLE
ImportError: cannot import name 'CREATE_NEW_CONSOLE'
Makefile:51: recipe for target 'unittests' failed
make: *** [cxbaseunit] Error
Run Code Online (Sandbox Code Playgroud)
为了测试,我尝试直接在 Python shell 中重复该错误:
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> from subprocess import CREATE_NEW_CONSOLE
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'CREATE_NEW_CONSOLE'
Run Code Online (Sandbox Code Playgroud)
但它仍然失败。有谁知道发生了什么事吗?
问候
看来您正在 Linux 中运行。该CREATE_NEW_CONSOLE常量仅在 Windows 上可用。
https://docs.python.org/3/library/subprocess.html#subprocess.CREATE_NEW_CONSOLE
具体来说,第 17.5.4 节的标题:
STARTUPINFO 类和以下常量仅在 Windows 上可用。
| 归档时间: |
|
| 查看次数: |
3364 次 |
| 最近记录: |