Firstly, uninstall opencv-python by:
pip uninstall opencv-python
then,
pip install opencv-contrib-python
That's it!
Sample code:
import cv2
img=cv2.imread('test.jpg')
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
sift=cv2.xfeatures2d.SIFT_create()
kp=sift(gray,None)
img=cv2.drawKeypoints(gray,kp,img)
cv2.imwrite('sift_keypoints.jpg',img)