感谢万能的google!

一开始google搜索“pycharm2022 invalid python sdk cannot set up a python sdk at python 3.11”,进入链接:'Cannot setup a Python SDK' in PyCharm project using virtualenv after OS reinstallation - Stack Overflow

 问题和我的类似,但是帖子提到了一个日志文件:idea.log,找出来。果然我的日志,大量报错:

2023-06-19 15:04:23,253 [7654476]   WARN - #c.j.p.s.f.PythonSdkFlavor - Couldn't get interpreter version: process exited with code 101
Unable to create process using 'D:\Program Files\python39\python39\python.exe -V'

2023-06-19 15:04:23,291 [7654514]   WARN - #c.j.p.s.f.PythonSdkFlavor - Couldn't get interpreter version: process exited with code 101
Unable to create process using 'D:\Program Files\python39\python39\python.exe -V'

2023-06-19 15:04:23,324 [7654547]   WARN - #c.j.p.s.f.PythonSdkFlavor - Couldn't get interpreter version: process exited with code 101
Unable to create process using 'D:\Program Files\python39\python39\python.exe -V'

再google“c.j.p.s.f.PythonSdkFlavor - Couldn't get interpreter version: process exited with code 101
Unable to create process using”

找到链接:https://youtrack.jetbrains.com/issue/PY-39571/Failed-to-Create-Interpreter-error-on-Windows-10-when-python-path-contains-space

 官网的,说是路径多了个空格的原因。把空格去掉,果然跑通了。

感谢万能的google

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐