【发布时间】:2020-10-20 08:01:12
【问题描述】:
对于新手的问题,我深表歉意。我正在尝试正确下载 Python 3.7 安装并将其与 VSCode 集成,并使用 flake8 作为 linter。我想为 Blender 开发自定义脚本做好准备。我在 Win10 x64 上。
- 我下载了“python-3.7.8-amd64.exe”安装包,安装好了。
- 我确保选中了将 python 添加到安装程序中的 PATH 环境变量的复选框。
- 我将 VSCode 指向新安装的解释器,然后系统提示我安装 linter。
- 有人推荐了 flake8,所以我在 VSCode 中选择了它并安装了。
- 在安装过程中,我收到以下警告:
WARNING: The script pyflakes.exe is installed in 'C:\Users\futur\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script pycodestyle.exe is installed in 'C:\Users\futur\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script flake8.exe is installed in 'C:\Users\futur\AppData\Roaming\Python\Python37\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed flake8-3.8.3 importlib-metadata-1.7.0 mccabe-0.6.1 pycodestyle-2.6.0 pyflakes-2.2.0 zipp-3.1.0
我检查了我的环境变量,结果如下:
我不明白为什么我在 %APPDATA% 中有两个 Python 目录。有:
C:\Users\futur\AppData\Local\Programs\Python\Python37\Scripts
还有:
C:\Users\futur\AppData\Roaming\Python\Python37\Scripts
flake8 安装在 Roaming 文件夹中,而我的主要 Python 安装在
C:\Users\futur\AppData\Local\Programs\Python\Python37
总之,这些是我的问题:
- flake8 是否安装在错误的目录中?
- 我应该将
C:\Users\futur\AppData\Roaming\Python\Python37\Scripts添加到我的 USER PATH 环境变量中,还是添加到我的 SYSTEM PATH 环境变量中? - 为什么 %appdata% 中有两个 Python 目录? (漫游和本地)
任何关于如何正确设置一切的指导都将是一个巨大的帮助,非常感谢。
编辑 1
非常感谢所有的答案。我想强调一下,我更愿意在不安装 Anaconda 的情况下解决这个问题。
编辑 2
我在这里取得了一些进展。我没有通过 VSCode 安装 flake8,而是运行了python -m pip install flake8,现在一切似乎都很好。
【问题讨论】:
标签: python python-3.x windows visual-studio-code flake8