我正在使用 Angular 和 Brython 进行第一次实验。一切都开始工作了,然后奇怪的是 Python 的标准库没有被识别。我很想知道为什么。
这是 html 部分(angular8 中的index.html ):
<html lang="en">
<head>
<meta charset="utf-8">
<title>HelloWorld</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body onload = "brython()">
<app-root></app-root>
<script type="text/python">
import os
</script>
</body>
</html>
这些是angular.json文件中链接的脚本
"scripts": [
"src/assets/js/script.js",
"src/assets/js/brython.js",
"src/assets/js/brython_stdlib.js"
]
为什么,尽管链接(大概)Python's stdlib
,回溯仍然存在:
ImportError: No module named os
是我忘记放别的东西了,还是这个问题无法解决?从某种意义上说,您不能在 angular8 中使用 Brython?