简体   繁体   English

尝试在 VSCode、Windows WSL2 上全局安装 autopep8

[英]Trying to get autopep8 installed globally on VSCode, Windows WSL2

I have this package installed, but it doesn't have that green start on the top left.我安装了这个包,但左上角没有那个绿色的开始。 When I format a document, it says autopep8 is not installed and would you like to install it.当我格式化文档时,它说没有安装 autopep8,你想安装它。 I hit yes, and it says it can't find the file C:/Users/User/AppData/Local/Programs/Python/Python38-32/python.exe: no such file or directory.我点击是,它说它找不到文件 C:/Users/User/AppData/Local/Programs/Python/Python38-32/python.exe: no such file or directory。

How do I fix this.我该如何解决。 I read I need to add a path, but I don't know where or how.我读到我需要添加一条路径,但我不知道在哪里或如何添加。 I'm new to VSCode and WSL2.我是 VSCode 和 WSL2 的新手。 If I run pip3 list on my WSL2 Ubuntu 20.04 it says I have autopep8 1.5.4.如果我在 WSL2 Ubuntu 20.04 上运行 pip3 list,它会说我有 autopep8 1.5.4。 But I can't format python documents.但我无法格式化 python 文档。

  1. Please check if Python is available.请检查 Python 是否可用。 Enter " where python " in the 'cmd' window:在“cmd”窗口中输入“ where python ”:

    在此处输入图片说明

  2. Please install and use the latest version of the Python extension in VSCode extension store.请在 VSCode 扩展商店中安装并使用最新版本的Python 扩展

  3. Please install the module " autopep8 " in the currently selected VSCode environment .请在当前选择的VSCode 环境中安装模块“ autopep8 ”。

    Check the source of the installation tool pip , it determines where the module is stored:检查安装工具pip的来源,它确定模块的存储位置:

    在此处输入图片说明

    Check the installation package: "pip show autopep8":检查安装包:“pip show autopep8”:

    在此处输入图片说明

Result:结果:

在此处输入图片说明

For more information about the use of Python in VSCode, you could refer to: Python in VSCode .更多关于Python在VSCode中的使用可以参考: Python in VSCode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM