python - Ubuntu (WSL) Python 与 Python3.7 Microsoft Store 应用程序分开?
问题描述
在 Windows 10 上,以下步骤成功安装并运行 Python-pyfiglet 模块:
- 启用 WSL(以管理员身份运行 PowerShell 并输入
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
) - 从 Microsoft Store 安装 Ubuntu
- 从 Microsoft 商店安装的 Windows 终端(预览版)
- 在 Windows Terminal > Ubuntu 中,我安装了 Python3 (
sudo apt-get install Python3
) - 在 Windows 终端 > Ubuntu 中,我安装了 python 包 pyfiglet (
sudo apt install python3-pyfiglet
) - 在 Windows 终端 > Ubuntu > python3 中,我运行
import pyfiglet
并print(pyfiglet.figlet_format("Hello World!"))
成功获得了预期的结果!
但是,当我尝试import pyfiglet
通过以下任何其他方式使用时:
- Python3.7 Store App(通过Microsoft Store app安装)
- Cmd > python3
- VSCode > 创建
hello_world.py
和调试,
不幸的是,这三种方法都导致ModuleNotFoundError: No module named 'pyfiglet'
.
为什么import pyfiglet
Windows Terminal > Ubuntu > Python3都成功,而其他三种打开python的方式都不成功?这些其他版本的 python 是否与 Ubuntu 版本的 python 分开?(我认为它们都是本质上来自 WSL 的相同版本的 python。)
如果它们确实都是单独的 python 安装,并且它们之间没有共享模块,那么如何为 Cmd / Python3.7 Store App / VSCode 版本重新安装(重复)pyfiglet?在 python 的 Cmd / Python3.7 Store App / VSCode 调试版本中尝试sudo apt install python3-pyfiglet
或失败。pip install pyfiglet
解决方案
推荐阅读
- python - 如何在 Python 中的数组内缩放(x 轴)和移动数据?
- elasticsearch - Elasticsearch 查询返回部分搜索词
- javascript - 如何将 HTML 表单保存为草稿,然后检索并填写其余部分?
- gatsby - dyld:惰性符号绑定失败:找不到符号:_node_module_register Gatsby realated
- database - Mongodb 通过单次查询在 Document 和 subDocument 中搜索
- javascript - EagerLoadingError [SequelizeEagerLoadingError]:grl_entidade 未关联到 stn_matriz_gerada
- arrays - 如何使用 React.useState 中的 Promise 函数以正确的模式数组更新?
- python - 我正在尝试从 pyspark 数据框创建配置单元表,但收到错误无关输入“/”
- excel - 如果单元格的值大于或小于该列中大于 0 的前一个值,如何突出显示该单元格?
- java - Maven 生成在我的远程 tomcat 上不起作用的 .war