美文网首页
VsCode中写Python 重命名文件夹导致 导包报错的坑

VsCode中写Python 重命名文件夹导致 导包报错的坑

作者: 房房1524 | 来源:发表于2019-10-12 17:31 被阅读0次

这个问题是VS code的坑,不主动更新路径

  1. 添加launch.json


    image.png

2.修改launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "env": {
                "PYTHONPATH": "${workspaceRoot}"
            },
            "envFile": "${workspaceFolder}/.env"
        }
    ]
}
  1. 再跑一次,就好了!!

相关文章

网友评论

      本文标题:VsCode中写Python 重命名文件夹导致 导包报错的坑

      本文链接:https://www.haomeiwen.com/subject/pwaqmctx.html