提交 673a2a7c authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #3917 from andreh7/2016-01-23-fix-for-custom-python-installations

fixes #3556: more robust determination of python library name
...@@ -1649,9 +1649,22 @@ def std_lib_dirs_and_libs(): ...@@ -1649,9 +1649,22 @@ def std_lib_dirs_and_libs():
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
std_lib_dirs_and_libs.data = [], [] std_lib_dirs_and_libs.data = [], []
else: else:
# assume Linux
# Typical include directory: /usr/include/python2.6 # Typical include directory: /usr/include/python2.6
libname = os.path.basename(python_inc)
std_lib_dirs_and_libs.data = [libname], [] # get the name of the python library (shared object)
libname = distutils.sysconfig.get_config_var("LDLIBRARY")
if libname.startswith("lib"):
libname = libname[3:]
# remove extension if present
if libname.endswith(".so"):
libname = libname[:-3]
libdir = distutils.sysconfig.get_config_var("LIBDIR")
std_lib_dirs_and_libs.data = [libname], [libdir]
# sometimes, the linker cannot find -lpython so we need to tell it # sometimes, the linker cannot find -lpython so we need to tell it
# explicitly where it is located this returns # explicitly where it is located this returns
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论