我已经用尽了要检查的内容列表,Python扩展程序似乎无法在我的OSX笔记本电脑上运行。
我重新安装了Python扩展程序,检查了所有设置是否都设置为documentation with pylint
,并在我的用户配置中定义了相关设置:
// Python settings
"python.linting.lintOnSave": true,
"python.formatting.formatOnSave": false,
"python.pythonPath": "/usr/local/bin/python",
"python.linting.pylintPath": "/usr/local/bin/pylint",
"python.linting.pylintArgs": []
(完整配置here)
但没有运气,没有错误信息,没有警告,没有。以下文件没有显示任何错误:
#!/usr/bin/env python
def foo
pass
也许我configuration中遗漏了一些东西?扩展在Linux中运行得非常好,所以我一定做错了,但我不知道是什么。
答案 0 :(得分:0)
使用pip安装jedi
库,在我的用户设置中添加路径,然后重新加载窗口后,我得到了pylint的错误:
...
File "/usr/local/lib/python2.7/site-packages/pylint/reporters/__init__.py", line 72, in encode
locale.getdefaultlocale()[1] or
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 543, in getdefaultlocale
return _parse_localename(localename)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: utf-8
这是我遇到的问题before,我认为通过在.bash_profile
添加以下行来解决这个问题:
# UTF-8 terminal
export LC_CTYPE=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8
export LANG=en_GB.UTF-8
但实际上我只有export LC_CTYPE="utf-8"
。将以前的行添加到我的.bash_profile
,然后重新启动VScode解决了我的问题。