-
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No module named leaderf #206
Comments
很奇怪,理论上,下面这几行已经把路径加到环境变量里了: Lines 52 to 54 in 910b4c8
你能加点打印看看出问题时你的 sys.path 里是什么吗?
|
['/c/Users/clouduan/.vim/plugged/LeaderF/autoload\\leaderf\\python', '\\\\?\\E:\\Applications\\Python35\\python35.zip', '_vim_path_'] 主要的就在这里了。感觉像是 |
不是 |
嗯我试了下确实是这样,这个好像没法改,感觉上只能手动改 |
你把上面代码那三行改成下面试试: exec g:Lf_py "import vim, sys, os.path, re"
exec g:Lf_py "cwd = vim.eval('expand(\"<sfile>:p:h\")')"
exec g:Lf_py "cwd = re.sub(r'(^.)', r'\1:', os.sep.join(cwd.split('/')[1:])) if os.name == 'nt' and cwd.startswith('/') else cwd"
exec g:Lf_py "sys.path.insert(0, os.path.join(cwd, 'leaderf', 'python'))"
|
可以了,感谢! exec g:Lf_py "cwd = re.sub(r'(^.)', r'\1:', os.sep.join(cwd.split('/')[1:])) if os.name == 'nt' and cwd.startswith('/') else cwd" 这里的 r |
exec g:Lf_py "cwd = re.sub(r'(?<=^.)', r':', os.sep.join(cwd.split('/')[1:])) if os.name == 'nt' and cwd.startswith('/') else cwd" 改成这样试试。 |
可以了 |
环境:Windows 10 git bash 自带 vim-8.1
执行
LeaderfFiles
后报错:no module named leaderf. 应该是这一行里 python 导入路径有问题。在Linux 下不会出错,但是 Windows 下经常遇到这种错误。LeaderF/autoload/leaderf/File.vim
Line 14 in 910b4c8
我手动把这个路径增加到了 python 的环境变量里才可以用。可以的话把这个情况也考虑进去,不然每次手动改很费事。
The text was updated successfully, but these errors were encountered: