我正在用virtualenv
在vscode中运行一个python项目。 Python解释器已正确设置。当我尝试发现测试时,它会提示我一个错误
python /Users/user/.vscode/extensions/ms-python.python-2019.10.44104/pythonFiles/testing_tools/run_adapter.py discover pytest -- -s project/
Test Discovery failed:
Error: spawn /Users/<username>/apps/project/venv/bin/python ENOENT
我的vscode settings.json看起来像这样,但我尚未配置launch.json
{
"python.pythonPath": "/Users/<username>/apps/project/venv/bin/python","python.testing.unittestEnabled": false,"python.testing.nosetestsEnabled": false,"python.testing.pytestEnabled": true,"python.testing.pytestArgs": [
"project"
],}
当我在终端python shell上输入/Users/<username>/apps/project/venv/bin/python
时打开。
ENOENT通常表示这是无效路径,但该路径看起来很正常。
$echo $PATH
/Users/<username>/apps/project/venv/bin