当我单击 PyCharm 上的“调试”按钮时,它错误地识别了
pydevd.py
文件所在的位置。
控制台消息如下;
C:\Users\young\AppData\Local\Microsoft\WindowsApps\python3.10.exe "C:/Users/young/AppData/Local/Programs/PyCharm Professional/plugins/python/helpers/pydev/pydevd.py" --multiprocess --qt-support=auto --client 127.0.0.1 --port 61823 --file C:\Users\young\Documents\GitHub\some-project\app.py
Connected to pydev debugger (build 232.10072.31)
* Serving Flask app 'app'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
* Restarting with stat
C:\Users\young\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe: can't open file 'C:\\Users\\young\\AppData\\Local\\Programs\\PyCharm': [Errno 2] No such file or directory
Process finished with exit code 2
原因似乎很清楚。由于路径中存在空格,路径
/PyCharm Professional/
被修剪。但我不知道如何在 IDE 设置中修复它。
请注意 PyCharm v2023.2.3 (232.10072.31)
我最终得到了 WSL(Ubuntu) 环境。
WSL 调试调用
pydevd
,如下所示,因此错误的路径没有被召回。
/home/young/.virtualenvs/some-project/bin/python /home/young/.pycharm_helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 59943 --file /mnt/c/Users/young/Documents/GitHub/some-project/app.py