python - 如何为 VS Code python 调试器和测试激活我的 conda 环境?
问题描述
当我尝试运行调试器时:
C:\Users\Philip\OneDrive\Betting\Capra\Tennis\polgara> cmd /C "C:/Users/Philip/miniconda3/envs/capra/python.exe c:\Users\Philip\.vscode\extensions\ms-python.python-2020.8.101144\pythonFiles\lib\python\debugpy\launcher 53607 -- c:\Users\Philip\OneDrive\Betting\Capra\Tennis\polgara\updater.py "
C:\Users\Philip\miniconda3\envs\capra\lib\site-packages\numpy\__init__.py:138: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
我已经弄清楚,如果我安装numpy
到我的base
环境中,那么我可以绕过这个错误。问题是如何capra
为调试器激活环境?
我尝试按照VS Code的指导进行操作:
1. pythonPath property of the selected debug configuration in launch.json
我的launch.json
文件:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"pythonPath": "C:/Users/Philip/miniconda3/envs/capra/python.exe"
}
]
}
下一个:
2. python.pythonPath setting in the workspace settings.json
我重新启动VS Code
并得到:
We removed the "python.pythonPath" setting from your settings.json file as the setting is no longer used by the Python extension. You can get the path of your selected interpreter in the Python output channel. [Learn more](https://aka.ms/AA7jfor).
最后:
3. python.pythonPath setting in the user settings.json
我的用户设置文件:
{
"terminal.integrated.shell.windows": "C:/WINDOWS/System32/cmd.exe",
"kite.showWelcomeNotificationOnStartup": false,
"python.venvPath": "C:/Users/Philip/miniconda3/envs/capra",
"python.pythonPath": "C:/Users/Philip/miniconda3/envs/capra/python.exe",
"terminal.integrated.automationShell.windows": "C:/WINDOWS/System32/cmd.exe",
"python.autoComplete.extraPaths": [
]
}
仍然得到相同的numpy错误。
Python Test Log
值得一提的是,当我在尝试发现测试后查看输出时,我得到了完全相同的错误。
解决方案
推荐阅读
- javascript - 防止使用 ng-hide 隐藏的内容在页面上短暂呈现?
- rust - 是否有类似 vec 的链表的等效宏!在锈
- bit-manipulation - 在任意两位中间加一点
- azure - 如何连接自定义域和 Azure 域
- pine-script - 将 linreg() 函数从 pinescript 转换为 thinkscript
- javascript - 如何制作 Vanilla JS XMLHttpRequest(Wordpress 网站)
- java - Maven 构建错误:为持久性单元“默认”关闭 JPA EntityManagerFactory
- javascript - useState 集不会在反应中立即更新
- xml - 从 SQL Server 中的 XML 列解析元素
- java - 如何在春季 JPA 中更新多行一次?