E: could not get lock /var/lib/dpkg/lock-frontend - open

E: could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporary unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is an other process using it

源程序:
import numpy as np
import cv2
import matplotlib.pyplot as plt

img1=cv2.imread(‘1.png’,cv2.IMREAD_UNCHANGED)#queryImage
img2=cv2.imread(‘2.png’,cv2.IMREAD_UNCHANGED)#trainImage

#Initiate SIFT detector
orb=cv2.ORB_create()

#find the keypoints and descriptors with SIFT
kp1,des1=orb.detectAndCompute(img1,None)
kp2,des2=orb.detectAndCompute(img2,None)

#create BFMatcher object
bf=cv2.BFMatcher(cv2.NORM_HAMMING,crossCheck=True)

#Match descriptors.
matches=bf.match(des1,des2)

#Sort them in the order of their distance.
matches=sorted(matches,key=lambda x:x.distance)

#Draw first 10 matches.
img3=cv2.drawMatches(img1,kp1,img2,kp2,matches[:60],outImg=1,flags=2)

plt.imshow(img3)
plt.show()

运行结果:
E: could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporary unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is an other process using it

解决方案:

1) 首先查看是否有apt-get这个程序在运行

ps aux|grep apt-get

2) 如果发现存在这样的程序在运行那么就kill掉,否则执行3)

3 )直接删除锁文件

sudo rm /var/lib/dpkg/lock-frontend

sudo rm /var/lib/dpkg/lock

修改后运行结果

E: could not get lock /var/lib/dpkg/lock-frontend - open_第1张图片

你可能感兴趣的:(E: could not get lock /var/lib/dpkg/lock-frontend - open)