python - VS Code 不使用 Python 执行 Python 代码
问题描述
尝试在 VS Code 中执行一些 Python 代码时,我收到以下错误消息:
from: can't read /var/mail/selenium.webdriver.common.keys
from: can't read /var/mail/selenium.webdriver.common.by
from: can't read /var/mail/selenium.webdriver.support.ui
from: can't read /var/mail/selenium.webdriver.support.ui
from: can't read /var/mail/selenium.webdriver.support
我认为这可能是因为它没有作为 Python 代码执行,但我对这一切都很陌生,我似乎无法纠正这个问题。奇怪的是,这段代码几周前我写的时候就可以工作了,但我不确定从现在到那时发生了什么。
我尝试将 VS Code 中的解释器设置为所有可用选项,并且我阅读了另一篇文章,该文章建议将以下行添加到代码顶部...
#!/usr/bin/env python
...但这也不起作用。如果有人能指出我正确的方向,我将不胜感激。
谢谢
解决方案
我建议在带有命令的终端中运行 python in vs code。python name_of_the_file.py 。但不要忘记 cd 进入正确的目录或使用正确的虚拟环境。
推荐阅读
- javascript - 从 href 调用 javascript 函数
- node.js - 使用节点 js 将 aac 文件写入光盘
- kubernetes - FailedScheduling:0/3 个节点可用:3 个 Pod 不足
- python - 使用 pandas groupby 查找列最大值的日期和值
- c++ - 可以在 lambda 运行之前使 lambda 捕获的 [this] 指针无效吗?
- python - 是否可以计算 AWS s3 对象的 sha256 或 sha1 哈希?
- firebase - 在 Firestore 安全规则中列出类型安全
- python - replace() 在 for 循环中不接受关键字参数
- regex - 我的正则表达式查找 IP 有效,但如何排除某些 IP
- schema.org - 在 JSON-LD 标记中验证组织徽标时未解决的错误:“需要‘url’字段的值。”