gpt4 book ai didi

json - apt-vim 插件 FileNotFoundError

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:24:06 26 4
gpt4 key购买 nike

我正在手动安装 Vim 的 apt-vim 插件,当我尝试命令 apt-vim install -y 时,brew 已安装,但出现以下错误:-e:1: '$(' is not allowed as a global variable name。但是,安装完成后,当我按照指示尝试 apt-vim init 时,出现另一个错误通过安装指南。

Traceback (most recent call last):
File "/Users/cssummer16/.vimpkg/bin/apt-vim", line 805, in <module>
apt_vim.main()
File "/Users/cssummer16/.vimpkg/bin/apt-vim", line 785, in main
self.process_cmd_args()
File "/Users/cssummer16/.vimpkg/bin/apt-vim", line 758, in process_cmd_args
self.MODES[mode]()
File "/Users/cssummer16/.vimpkg/bin/apt-vim", line 534, in first_run
shutil.copy('vim_config.json', VIM_CONFIG_PATH)
File "/Users/cssummer16/anaconda/lib/python3.5/shutil.py", line 235, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/Users/cssummer16/anaconda/lib/python3.5/shutil.py", line 114, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'vim_config.json'

在我的 apt-vim 文件中,全局 VIM_CONFIG_PATH 设置为 os.path.abspath(os.path.join(SCRIPT_ROOT_DIR, 'vim_config. json'))。这是我的 vim_config_json 文件,它应该与我从 apt-vim 存储库中获得的文件相同。

{
"global": {
"depends-on": [
{
"name": "vim",
"recipe": {
"darwin": [],
"linux": [
"sudo apt-get install -y vim"
]
}
},
{
"name": "git",
"recipe": {
"darwin": [],
"linux": [
"sudo apt-get install -y git"
]
}
},
{
"name": "brew",
"recipe": {
"darwin": [
"ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\""
],
"linux": []
}
},
{
"name": "python",
"recipe": {}
}
],
"install-target": "~/.vimpkg/bundle"
},
"packages": [
{
"depends-on": [],
"name": "pathogen",
"pkg-url": "https://github.com/tpope/vim-pathogen.git",
"recipe": {
"all": [
"mkdir -p ~/.vim/autoload",
"curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim"
]
}
},
{
"depends-on": [
{
"name": "ctags",
"recipe": {
"darwin": [
"curl -LSso ctags-5.8.tar.gz 'http://sourceforge.net/projects/ctags/files/ctags/5.8/ctags-5.8.tar.gz/download?use_mirror=iweb'",
"tar xzf ctags-5.8.tar.gz",
"cd ctags-5.8",
"sudo ./configure",
"sudo make",
"sudo make install"
],
"linux": [
"curl -LSso ctags-5.8.tar.gz 'http://sourceforge.net/projects/ctags/files/ctags/5.8/ctags-5.8.tar.gz/download?use_mirror=iweb'",
"tar xzf ctags-5.8.tar.gz",
"cd ctags-5.8",
"sudo ./configure",
"sudo make",
"sudo make install"
]
}
}
],
"name": "tagbar",
"pkg-url": "https://github.com/majutsushi/tagbar.git",
"recipe": {}
}
]
}

这是分配所有全局路径变量的 apt-vim 文件中的代码块。

import json, sys, os, re, shutil, shlex, getopt, platform, stat, ast
from distutils.util import strtobool
from subprocess import call, check_output, CalledProcessError

HOME = os.path.expanduser("~")
SCRIPT_ROOT_DIR = os.path.abspath(os.path.join(HOME, '.vimpkg'))
VIM_ROOT_DIR = os.path.abspath(os.path.join(HOME, '.vim'))
BUNDLE_PATH = os.path.abspath(os.path.join(VIM_ROOT_DIR, 'bundle'))
SRC_DIR = os.path.abspath(os.path.join(SCRIPT_ROOT_DIR, 'src'))
BIN_DIR = os.path.abspath(os.path.join(SCRIPT_ROOT_DIR, 'bin'))
VIM_CONFIG_PATH = os.path.abspath(os.path.join(SCRIPT_ROOT_DIR, 'vim_config.json'))
SCRIPT_EXE_PATH = os.path.abspath(os.path.join(BIN_DIR, 'apt-vim'))

在 ~/.vimpkg 中只有一个 vim_config.json 文件的副本。如果有人能指出正确的方向来解决此安装问题,我将不胜感激。

最佳答案

这里是 apt-vim 的维护者。

很遗憾您遇到了这个错误。不完全确定为什么会这样,但它似乎是 brew 的自动安装的问题(请参阅 vim_config.json --> brew 配方)。

作为变通方法,首先尝试使用来自 brew.sh 的官方安装命令安装 brew :/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后,尝试再次启动 apt-vim init。如果您仍然遇到问题,请在 apt-vim's GitHub page 上提出问题.谢谢!

关于json - apt-vim 插件 FileNotFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38151592/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com