// Split the message content to extract text and origin
var text = {};
text.payload = (msg.originalMessage.text.split("_._"))[0];
text.type = "text";
var origin = {};
origin.payload = (msg.originalMessage.text.split("_._"))[1];
origin.type = "origin";
msg.payload.text = text.payload;
msg.payload.origin = origin.payload;
return [text,origin];
这是我在键入命令“ pip install turicreate”后收到的消息。
我正在使用ubuntu 20.4,并在系统上安装了python 3.8.2
答案 0 :(得分:3)
Turicreate还不支持Python 3.8。您必须使用早期的python版本(例如3.7)才能使turicreate正常工作。
答案 1 :(得分:0)
您可以使用任何受支持的版本创建虚拟环境,然后安装turicreate。它在Ubuntu 20.04和Ubuntu 16.04上运行良好,只要不添加python3.8支持,它是使用turicreate的不错选择。
安装任何受支持的python版本,并记下其安装路径(安装文件夹通常为/ usr / bin /,但可能有所不同)。使用function updateSequentialReferences() {
const body = DocumentApp.getActiveDocument().getBody();
replaceSequentially(body, "\\(see example \\d+\\)", count => `(see example ${count})`);
replaceSequentially(body, "^\\(\\d+\\)(.*)$", (count, match) => match.replace(/^\(\d+\)/, `(${count})`));
}
function replaceSequentially(body, regexString, replacerFn) {
let foundRef = body.findText(regexString);
let count = 1;
while (foundRef !== null) {
const {element, end, start} = unwrapRangeElement(foundRef);
const text = element.asText();
const match = text.getText().slice(start, end + 1);
text.deleteText(start, end);
text.insertText(start, replacerFn(count, match));
++count;
foundRef = body.findText(regexString, foundRef);
}
}
function unwrapRangeElement(element) {
return {
element: element.getElement(),
end: element.getEndOffsetInclusive(),
start: element.getStartOffset(),
}
}
安装virtualenv。导航到您的项目,然后使用pip install virtualenv
在项目文件夹中创建虚拟环境。
我用python3.6创建了它,所以对我来说是virtualenv -p /path/to/python/installation venv
。然后通过键入virtualenv -p /usr/bin/python3.6 venv
激活新的虚拟环境。使用source venv/bin/activate
检查python版本。
然后继续安装turicreate。
完成工作后,使用python --version
命令停用虚拟环境