有没有办法告诉python是否配置和编译与“ - 与线程 - 共享共享”? [英] Is there a way to tell if python was configured and compiled with "--with-threads --enable-shared"?

查看:86
本文介绍了有没有办法告诉python是否配置和编译与“ - 与线程 - 共享共享”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是针对Debian Squeeez上的Python 2.6.6。我试图找出debian附带的二进制文件是否配置了以下标志:

   - 线程 - -enable-shared 

好像他们不是我需要从源码自己编译和安装。 / p>

解决方案

- 线程(这是默认值) Python支持线程,这将意味着 import thread 将会工作。一个简单的测试方法是使用 python $ version -m线程



启用共享将意味着Python附带一个 libpython $ version.so 文件,安装在$ code> $ prefix / lib (和 python $ version 目录,不在里面)。最简单的做法是查看文件是否存在 - 假设你想知道因为你需要使用这个libpython共享库。如果您确实需要知道 python $ version 二进制是否使用此共享库, ldd 会告诉你的。我做出这样的区别,因为Debian,即使 / usr / bin / python $ version /usr/lib/python$version.so / code>是静态链接的。


This is for Python 2.6.6 on Debian Squeeez. I'm trying to find out if the binaries shipped with debian were configured with the flags of:

--with-threads --enable-shared

as if they were not I will need to compile and install from source myself.

解决方案

--with-threads (which is the default) will mean Python supports threading, which will mean import thread will work. An easy way to test this is with python$version -m threading

--enable-shared will mean Python comes with a libpython$version.so file, installed in $prefix/lib (alongside the python$version directory, not inside it.) The easiest thing to do is to look if that file is there -- assuming you want to know because you need to use this libpython shared library. If you actually need to know if the python$version binary uses this shared library, ldd will tell you that. I make that distinction because on Debian, /usr/lib/python$version.so will exist even though /usr/bin/python$version is statically linked.

这篇关于有没有办法告诉python是否配置和编译与“ - 与线程 - 共享共享”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆