我已经关注these instructions,以便在Vim中安装YouCompleteMe,但是当我发出时:
./install.py --clang-completer
出现以下错误消息:
Searching Python 2.7 libraries...
ERROR: found static Python library (/usr/local/lib/python2.7/config/libpython2.7.a) but a dynamic one is required. You must use a Python compiled with the --enable-shared flag. If using pyenv, you need to run the command:
export PYTHON_CONFIGURE_OPTS="--enable-shared"
before installing a Python version.
Traceback (most recent call last):
File "./install.py", line 44, in <module>
Main()
File "./install.py", line 33, in Main
subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] )
File "/usr/local/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', u'/home/anmol/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py', '--clang-completer']' returned non-zero exit status 1
现在我被困了,我该怎么办?
答案 0 :(得分:10)
我检查了YouCompleteMe的构建系统,它使用了一个自定义构建脚本,该脚本使用Python模块distutils
来查找Python库和包含目录的路径。在正式/usr/local/
安装之前,您的PATH
变量可能已包含在/usr
变量中,因此仅运行python
可能会运行自定义安装,从而使distutils
返回它的目录。
要检查是否属实,请尝试运行which python
。我假设它会返回类似/usr/local/bin/python
的内容。
此时,我看到了几个选项。
/usr/bin/python ./install.py --clang-completer
编辑YouCompleteMe插件目录中的脚本third_party/ycmd/build.py
,对自定义Python安装的路径进行硬编码。例如,您可以使用以下内容替换现有的FindPythonLibraries
函数:
def FindPythonLibraries():
return ('/usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so',
'/usr/include/python2.7')
请注意,这将使更新YouCompleteMe变得更加困难,因为您必须确保在更新其来源时不会覆盖它。
dpkg -S /usr/local/lib/python2.7/config/libpython2.7.a
检查是否通过包安装了它。此命令将告诉您安装该文件的软件包,除非您手动安装它(绕过软件包管理器)。/usr/local
Python安装,同时确保安装了官方存储库中的Python(包python2.7
和libpython2.7
)。从长远来看,使用官方Python软件包可能会更好。
答案 1 :(得分:0)
该插件在同一操作系统上为我构建。配置中的相关行如下所示:
public static void sort(int[] A, int p, int r) {
if (p < r) {
int q = r - 1;
sort(A, p, q);
combine(A, p, q, r);
}
}
private static void combine(int[] A, int p, int q, int r) {
int i = q - p;
int val = A[r];
while (i >= 0 && val < A[p + i]) {
A[p + i + 1] = A[p + i];
A[p + i] = val;
i--;
}
}
public static void main(String... strings) {
int[] A = { 2, 5, 3, 1, 7 };
sort(A, 0, A.length - 1);
Arrays.stream(A).sequential().forEach(i -> System.out.print(i + ", "));
}
可以将共享对象标识为属于Found PythonLibs: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
包:
libpython2.7
所以我会检查你是否有文件命名,如果没有尝试apt-file search /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
libpython2.7: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
,否则尝试移走静态版本,或者告诉我们你是如何安装Python的。