Visual Code 配置 Anaconda解释器
PyCharm比较“重量级”,可以选择轻量级的集成开发环境(Integrated Development Environment,IDE)来运行简单代码
软件安装
1.安装VS Code
2.安装Anaconda
环境配置
1.安装Python插件(插件默认安装到C盘的一个位置)
2.打开项目文件夹
3.选择Anaconda解释器Interpreter
在VS Code中按Ctrl+P,输入select interpreter,选择
测试
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
出现红色报错是因为Anaconda3未放入系统环境变量,但任然可以运行。解决方法: