简体   繁体   English

导入 python3 模块时带有 PyExc_OSError 的 vim74

[英]vim74 with PyExc_OSError when importing python3 module

I have compiled vim with python3 support.我已经编译了支持 python3 的 vim。 But when I type vim -c 'python3 import logging' in the bash, the vim can't execute the command correctly.但是当我在 bash 中输入vim -c 'python3 import logging'时,vim 无法正确执行命令。

Error detected while processing command line:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.4/logging/__init__.py", line 26, in <module>
    import sys, os, time, io, traceback, warnings, weakref, collections
ImportError: /usr/local/lib/python3.4/lib-dynload/time.cpython-34m.so: undefined
 symbol: PyExc_OSError

I don't know the reason.我不知道原因。

I figured this out!我想通了! You can check this problem in vim more correctly by doing:您可以通过执行以下操作在 vim 中更正确地检查此问题:

:python3 import time

The problem stems from the Python 3 build, caused by not enabling shared libraries.问题源于 Python 3 构建,由未启用共享库引起。 You can check if you have this problem:您可以检查您是否有此问题:

vim$ python3 -c "import sysconfig; print(sysconfig.get_config_vars()['CONFIG_ARGS'])"
'--prefix=/u/home/j/joelfred/opt' '--enable-shared' '--enable-big-digits' '--enable-ipv6' 'PKG_CONFIG_PATH=/u/home/j/joelfred/opt/lib/pkgconfig:'

Notice I have --enable-shared as a result.请注意,我有--enable-shared结果。 If this isn't there, you will need to recompile Python 3. I would recommend using the options that show up here, and adding --enable-shared .如果这不存在,您将需要重新编译 Python 3。我建议使用此处显示的选项,并添加--enable-shared Once recompiled, you shouldn't have any problems.一旦重新编译,你应该没有任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM