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未放入系统环境变量,但任然可以运行。解决方法:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)