我在 Ubuntu 20.04 上使用 VS Code。我读过 Ubuntu 20.04 只支持 python3。当我尝试运行 python3 代码时,它给了我一个语法错误,但我相信这是因为其中一个依赖项正在使用 python2.7。这是我在 {prg}' 后用单引号声明无效语法的错误。有没有办法升级消息中引用的 pyimport 包,还是我在这里遗漏了其他东西?
================================ test session starts ================================
platform linux2 -- Python 2.7.18rc1, pytest-4.6.9, py-1.8.1, pluggy-0.13.0
rootdir: /home/ryan/tiny_python_projects/01_hello
collected 0 items / 1 errors
====================================== ERRORS =======================================
_____________________________ ERROR collecting test.py ______________________________
/usr/lib/python2.7/dist-packages/_pytest/python.py:507: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/lib/python2.7/dist-packages/py/_path/local.py:701: in pyimport
__import__(modname)
E: File "/home/ryan/tiny_python_projects/01_hello/test.py", line 21
E: out = getoutput(f'python3 {prg}')