Is it possible to install the SSL module for python on a linux box that already has OpenSSL installed without recompiling python? I was hoping it would be as simple as copying over a few files and including them in the library path. Python version is 2.4.3. Thanks!
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
NOTE: Python >= 2.6 already has SSL support built-in, there's no need to install
ssl
package.Install package from pypi:
If you're missing
pip
command, install it for your distribution:RedHat/Centos:
Debian/Ubuntu
Yes. Python's
setup.py
uses the following logic to detect OpenSSL:The point is Python is not static linking against
libssl
andlibcrypto
. (Some static linking occurs withcctyes
, but nothing else).Now, the bad thing is that the project uses system paths before your locally installed paths. For example, the project uses
inc_dirs
(system) beforesearch_for_ssl_incs_in
(local). (See more on this below).After you run
configure
, you will have aModules/Setup
with the following lines commented out:Again, no static linking. (And this assumes the previous version of Python uncommented those lines).
So you should be able to build a binary compatible version of OpenSSL and use
LD_LIBRARY_PATH
orLD_PREOLAD
to ensure Python uses your updated version of OpenSSL.OpenSSL 0.9.7 and 0.9.8 are binary compatible. OpenSSL 1.0.0, 1.0.1 and 1.0.2 are binary compatible. OpenSSL 0.9.8 and 1.0.0 are not binary compatible.
----------
Here's the problem with Python's setup placing system includes before local includes:
Python used the down level version 0.9.8 version of OpenSSL provided by Apple, and not my recent OpenSSL 1.0.1k. That's despite me (1) exporting them in
CFLAGS
andLDFLAGS
; (2) editingSetup
; and (3) editingModules/Setup
.And I still have runtime path problems to contend with, so I'll need to use
LD_PRELOAD_PATH
,DYNLIB_LIBRARY_PATH
, etc.