A tube exchanging device of a three dimensional (3D) printer for allowing containers of multiple materials (tubes) to be used in printing includes a plurality of tubes and a holder. The holder comprises a first side wall and a first bottom wall, and a plurality of first clamping parts is installed on the first side wall. Each first clamping part fixes a tube on the holder, each first clamping part comprises two hooking parts, which are set in two front ends of the first clamping part. Each tube comprises a guiding surface and two locking surfaces. When the two hooking parts slide from the guiding surface to the two locking surfaces, the two hooking parts are limited by the two locking surfaces to fix the tube on the holder.