VScode 设置Python不同版本运行环境

1.首先本地安装有不同的Python的版本,比如2.7和3.5.mac下一般默认自带2.7版本。 
终端输入侧  python -V  则显示默认版本号。而 python3 -V  则显示3.XX版本。 
2.终端输入查找需要即将使用的蟒版本的路径,如 which python3 。复制其路径,打开vscode。 

3.打开首选项,搜索python.setting.json里有很多关于蟒的配置,如果没有则需要安装蟒插件就好了。重点来了,找到  ,把之前复制的蟒路径复制到这替换,新建一个用户设置保存。

4.新建一个test.py文件,右键运行蟒蛇文件...即可使用python3 

// Path to Python, you can use a custom version of Python by modifying this setting to include the full path. 
"python.pythonPath": "python"
"python.pythonPath": "/usr/local/bin/python3"

猜你喜欢

转载自blog.csdn.net/Mayxc/article/details/80335887
今日推荐