Visual Studio Code的几个问题

Posted scruffybear

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Visual Studio Code的几个问题相关的知识,希望对你有一定的参考价值。

文章目录

小结

最近在使用Visual Studio Code的时候,碰到几个问题:安装linting,添加额外的环境路径PYTHONPATH,ANACONDA,以及调试等等,进行了解决。

问题和解决

Linting Python in Visual Studio Code

Linging可以对Python语言错误进行检查,参考Linting Python in Visual Studio Code 进行安装使用。

Visual Studio Code代码浏览

参考How can I navigate back to the last cursor position in Visual Studio Code?
Alt + ← … navigate back 也就是ALT + 左箭头后退

Alt + → … navigate forward也就是ALT + 右箭头前进

pyc进行反编译

下载Easy Python Decompiler 这个软件可以对pyc进行反编译。

添加额外的PYTHONPATH环境路径

参考Stackoverflow: Visual Studio Code - How to add multiple paths to python path?
Using Python environments in VS Code

CTRL + SHIFT + P进入命令行再进入Python: Select Interpreter可以选择运行环境

CTRL + SHIFT + D进入调试设置,创建launch.json和settings.json

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",
            "justMyCode": true,
            "env":  "PYTHONPATH": "C:\\\\ProgramData\\\\Anaconda2:C:\\\\ProgramData\\\\Anaconda2\\\\Lib:C:\\\\ProgramData\\\\Anaconda2\\\\DLLs:C:\\\\ProgramData\\\\Anaconda2\\\\Lib\\\\lib-tk" 
        
    ]

settings.json内容如下:


    "python.testing.pytestArgs": [
        "."
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,
    "python.analysis.extraPaths": [
        "C:\\\\Program Files (x86)\\\\LibSE\\\\Python27",
        "C:\\\\Program Files (x86)\\\\LibSE"
    ]

以上python.analysis.extraPaths是额外的环境路径。

安装ANACONDA

参考Fix: ‘conda’ is not recognized as an internal or external command, operable program or batch file
https://repo.anaconda.com/archive/
对ANACONDA进行安装

参考

Linting Python in Visual Studio Code
How can I navigate back to the last cursor position in Visual Studio Code?
Easy Python Decompiler
Stackoverflow: Visual Studio Code - How to add multiple paths to python path?
Using Python environments in VS Code
How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
Fix: ‘conda’ is not recognized as an internal or external command, operable program or batch file
https://repo.anaconda.com/archive/
Python debugging in VS Code

以上是关于Visual Studio Code的几个问题的主要内容,如果未能解决你的问题,请参考以下文章

开发环境安装 Visual Studio Code 开发环境 ( 下载 Visual Studio Code 安装器 | Visual Studio Code )

Visual Studio Code 帮助查看器,指定的用于安装帮助内容的位置无效,或者您无权访问该位置

visual studio code 怎么用

Vim,Visual Studio Code,Emacs 哪个好

我电脑的visual studio code 运行不了c++?

visual studio 和visual studio code 的区别