Two solutions:
calculate the complete matrix directly, and the access the q-th column for the values between A and B[q].
d = scipy.spatial.distance.cdist(A,B)
for q in range(len(B)):
y = d[:,q]
print y
If the resulting matrix is too big to hold in memory. You could do this.
for q in range(len(B)):
y = scipy.spatial.distance.cdist(A,[B[q]])
print y