问题标签 [vscode-python]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - Run single folder of pytest tests in vscode
I have a sort of a "micro-service" Python repo with a setup similar to the following:
In vscode I only have the option of running all tests in foo
,bar
,shared
or running individual test methods in the subfolders. What I want to do is be able to quickly run just the foo/tests/
.
Is there some way I can configure pytest/Python to do this? I don't want to split each top level folder into its own workspace because I regularly jump back and for between them and don't want to have multiple windows per workspace open.
python - 如何在 vscode 中导入 pygame?
我已经在 vscode 上安装了 pygame,但 vscode 无法导入 pygame 显示此错误ModuleNotFoundError: No module named 'pygame'
任何帮助?
python - 像 PyCharm 一样在 VS Code 上安装(或建议)缺少导入的 Python 模块
当我们在当前环境使用的 Python 上导入当前未安装的模块时,PyCharm 建议我们“安装缺少的模块”,如果您单击安装,它会自动安装它...
是否有任何用于执行此操作或类似功能的 vscode 插件?例如,我想导入emoji
,就像 pycharm 一样,建议我安装缺少的模块,所以我不必手动进行 pip install
有没有为vscode做这个的插件?谢谢
python - VS Code 终端中出现意外的 Python 版本
我刚刚在 MacOS 上安装了 VS Code、Python(2019 年 10 月 15 日发布的 3.7.5 版)。所以我python --version
在我的 VS Code 终端上运行,结果显示Python 2.7.11
.
不应该是3.7.5吗?
visual-studio-code - Get VS Code Python extension to connect to Jupyter running on remote AWS EMR master node
I have a working Jupyter server running on an EMR master node where I can run python and pyspark code with no issue. When trying to get the VS Code Python extension to connect to the very same Jupyter server, I get the following error:
I created my own self-signed certificate on the EMR cluster by following these instructions from IBM. Then added the certificate to Chrome following these stack overflow instructions another user linked to on GitHub.
From the bash terminal of the EMR master node:
Downloaded certificate.p12
to my local computer, and then adding to Chrome: chrome://settings/privacy
> Manage certificates > Import > Select and import certificate.p12
> Restarting VS Code.
I still get the same error.
- Should I create either the
key.pem
andcertificate.pem
on my local then combine into a certificate? - Do I need to use the original
.pem
key issued when creating the EMR cluster?
python - VSCODE 中的 Jupyter Notebook 内核崩溃
我对使用 VSCode 的 Jupyter notebook 功能很感兴趣,我只是想掌握它。我可以启动内核并在 VSCode 中运行笔记本单元。
运行特定单元后,它似乎在没有警告的情况下崩溃,并且代码失败,因为变量已被清除。我必须重新选择右上角的内核并从头开始再次运行代码,直到我到达问题单元格,然后问题再次出现。
我认为这与 Python 代码无关,它是一些简单的数据框操作。我尝试过在浏览器中运行相同的笔记本,它运行良好。我正在使用 Python 3.7.6、MacOS Catalina (10.15.4)、VSCode 1.45.1 通过 venv 运行 Jupyter。
我注意到可能有助于指示正在发生的事情是,当它崩溃时,我可以在笔记本单元格中运行基本的 python 语句(无需重新选择内核)。但是,当我运行尝试从同一文件夹中的 .py 文件导入测试或使用相对路径导入数据文件的单元时,它无法找到它们,直到我重新选择内核。cwd好像变了?有人可以帮忙吗?
python - Generating random numbers in Python using random.randrange(). After the final number is generated, a "%" is created. How can I fix this?
This is the output I get when I enter 1, for example:
You selected 1. The following 3-digit lottery number was generated:
657%
How can I get rid of this percentage sign? I am using VSCode to compile. Thanks.
visual-studio-code - 任何人都知道如何在 VSCode python 测试资源管理器中修复这个滚动错误?
我的问题是我有大量的单元测试,其中许多已经过时并且需要修复。如果我尝试只运行 1 个特定的单元测试,测试资源管理器将正确运行该测试,但会进行大量滚动并失去其位置。
注意:在 gif 中,当我单击特定测试的运行按钮时会发生这种情况,但如果我单击代码本身中的 CodeLens 也会发生这种情况。