title: How to upgrade openssl version and link it to python 3.6.5
body: <p>I have several versions of python my Ubuntu machine. The default is 2.7. However, I could manage to run python 3.6 by going to a specific path which is: </p>
  
  <pre><code>/usr/local/bin/code/tls-client
  </code></pre>
  
  <p>I need to use <code>openSSL</code> library in my python code. I want to run specific version: <code>1.1.0</code>. I tried to use <code>pip install openssl</code> then check if the version got updated, but it is not. </p>
  
  <pre><code>python3
  Python 3.6.5 (default, May  3 2018, 10:08:28) 
  [GCC 5.4.0 20160609] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import ssl
  &gt;&gt;&gt; ssl.OPENSSL_VERSION
  'OpenSSL 1.0.2g  1 Mar 2016'
  </code></pre>
  
  <p>How can I link python 3.6.5 to a specific version of openSSL (say OpenSSL 1.1.0)? or even 1.1.1 (if possible)?</p>
  
  <p><strong>EDIT:</strong>
  After compiling it from the source as the answer suggests, I checked the verison and this is what I get:</p>
  
  <pre><code>/usr/local/bin/openssl-1.1.0h$ openssl version -a
  OpenSSL 1.0.2g  1 Mar 2016
  built on: reproducible build, date unspecified
  platform: debian-amd64
  options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx) 
  compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
  OPENSSLDIR: "/usr/lib/ssl"
  </code></pre>