Anaconda是目前最方便的Python发行版本。
通过官方的操作文档进行安装,在选择安装visual studio code时,会出现VSCode Installtion Failed。
解决方法:
在Finder中Go找到文件夹,输入:/anaconda3/pkgs/vscode_inst.py,会帮助我们直接定位到这个文件夹,找到def haveInternet。
在文件中添加:allow_redirects=True。如下:
def haveInternet():
try:
r = requests.head(VSCODE_ENDPOINT, timeout=5, allow_redirects=True)
assert r.status_code == 200
return True
except Exception as e:
log.exception('haveInternet')
return False

虽然不同的系统略有差异,但是在这个文件夹/anaconda3/pkgs/vscode_inst.py里找到def haveInternet里,添加allow_redirects=True,即可解决。
网友评论