Pervasive computing is characterized bythe integration with communication and digital mediatechnology embedded to the people's living space. People can transparently access the digital service anywhere.Wireless sensor networks are a novel technology and havebroad application prospects. With the maturity of thewireless sensor networks technology, pervasive computingis becoming a reality. It is become a new technology challenge to process the data streams of sensor networks forpervasive environment effciently and to find useful knowledge in these data streams. A k-means data stream clustering algorithm based on sensor networks is presented.The main idea of this algorithm is to select the initial centroids according to the aggregation gain of the node, thento cluster the data stream using the average square error.The experimental results are showed that this algorithm iseffective and effcient.