As you already mentioned, both operations are blocking, so you won't to be able to use real terminal input. Nevertheless, you can mimic such a behaviour without needing an actual terminal.
So, after showing the image, you would just press some numeric keys (since you convert to int, I assume you only want to input integer values), concatenate these in some intermediate string, use some final non-numeric key, for example x, to stop the input, and finally convert the string to your final numeric value.
That'd be some code snippet:
import cv2
# Read image
image = cv2.imread('path/to/your/image.png')
# Show image
cv2.imshow('window', image)
# Initialize label string
label_as_str = ''
# Record key presses in loop, exit when 'x' is pressed
while True:
    # Record key press
    key = cv2.waitKey(0) & 0xFF
    # If 'x' key is pressed, break from loop
    if key == ord('x'):
        break
    # Append pressed key to label string
    label_as_str += chr(key)
# Convert label string to label
label = int(label_as_str)
# Close all windows
cv2.destroyAllWindows()
# Output
print(label, type(label))
I don't know what you want to do with the input, but the above script can be used inside other loops with different images for example, etc.
----------------------------------------
System information
----------------------------------------
Platform:    Windows-10-10.0.16299-SP0
Python:      3.8.5
OpenCV:      4.4.0
----------------------------------------