”
这发生在我通过the端子运行电子应用程序时,烧瓶应用也会运行。当我这样做时,会出现以下错误:
npm start
我跑了stderr: from jsonschema import validate
ModuleNotFoundError: No module named 'jsonschema'
,发现“ jsonschema”确实是
努力解决
i怀疑这是通过安装错误并将以下行添加到我的烧瓶应用程序并独立运行以下行引起的一些错误:
pip freeze > requirements.txt
this this Prints:
import sys
print("Executing in", sys.executable)
if "jsonschema" in sys.modules:
print("JSONSchema is in the modules")
else:
print("jsonschema isn't in the modules")
Executing in [...]/py/.venv/bin/python3
JSONSchema is in the modules
pip install jsonschema
时,我收到了以下消息:
python -m pip install jsonschema
说他们正在安装到Python3.10中。当使用哪个位置为“ [...]/py/.venv/lib/python3.10/site-ackages”时,这将证实这一点。
Edit:
python -m pip show jsonschema
表明 /python和/python3.10都指向“ python3”,而 /python3指向“ /usr /bin /python3”。我认为这意味着Python3.10是Python3的一个分支,因此问题在于,在Python3中运行的“ doutes.py”文件无法从Python3.10导入JSonschema,因为它是上游的?考虑到这一点,我尝试运行:
ls -la py/.venv/bin/python*
专门将模块安装到Python3中,但与以前相同的“需求已经满足”的消息,使我更加困惑。 在评论中,我尝试通过电子应用程序运行
lrwxrwxrwx 1 <username> <username> 7 Feb 18 11:46 py/.venv/bin/python -> python3
lrwxrwxrwx 1 <username> <username> 16 Feb 18 11:46 py/.venv/bin/python3 -> /usr/bin/python3
lrwxrwxrwx 1 <username> <username> 7 Feb 18 11:46 py/.venv/bin/python3.10 -> python3
线,该线路给出了:py/.venv/bin/python3 -m pip install jsonschema
这就是实际问题:出于某种原因,通过电子应用程序运行到与独立运行时,Blask应用程序正在执行其他解释器。
是默认的Python解释器的路线,所以我在下面更改了它工作空间的范围指向“ [...]/py/.venv/bin/python3”,就像烧瓶Sys.ss.ss.scutable,但没有任何更改。 看着设置,它指出:
print("Executing in",sys.executable)
因此,我也尝试更改远程和用户默认的解释器路径,但这一无所有。为什么电子应用不在正确的解释器上运行?为什么专门运行?我该如何更改它以在“ [...]/py/.venv/bin/python3”上运行 因此,问题在于我如何在main.js文件中产生flaskproc。我正在使用
Executing in C:\Python312\python.exe
jsonschema isn't in the modules
,只是以为PY被用来表明它是运行Python代码,但是,默认情况下似乎在
C:\Python312\python.exe
上运行该代码。
I发现我可以将Spawn设置为“ WSL”,以告诉Node运行WSL命令。然后,我将通往虚拟环境和脚本作为参数的路径传递,因此它将两者都运行,从而允许脚本在WSL虚拟环境中运行。最终看起来像这样:
The setting has also been modified in the following scopes:
- Remote
- User
,这是完整的连接功能,以防将来帮助某人,尽管我觉得这篇文章应该表明我绝不是对此的权威,大声笑:
C\Python312\python.exe
感谢您对所有帮助的人!