Sample code for 30+ languages & platforms
CkPython

Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem

See more OpenSSL Examples

How to output the public part of a private key: Demonstrates how to duplicate this OpenSSL command:
openssl pkey -in private.pem -pubout -out pubkey.pem

Chilkat CkPython Downloads

CkPython
import sys
import chilkat

success = False

pkey = chilkat.CkPrivateKey()

# Load the private key from an PEM file:
success = pkey.LoadPemFile("private.pem")
if (success == False):
    print(pkey.lastErrorText())
    sys.exit()

pubKey = chilkat.CkPublicKey()
pkey.ToPublicKey(pubKey)

success = pubKey.SavePemFile(False,"pubKey.pem")
if (success != True):
    print(pubKey.lastErrorText())

    sys.exit()

print("Success.")