Spin model plays an important role in the realization of quantum information processing. Quantum entanglement can be constructed, also （swap）n quantum logic gate is available if anisotropy is ignored, when Heisenberg interaction between spins is used; thus a complete quantum computing gate will be realized by combining single-qubit rotation gate. To study the influence of anisotropy on logic gate has high academic value since anisotropy is inevitable in any solid material. In this paper, swap operation in a two-qubit anisotropy XYZ model in the presence of an inhomogeneous magnetic field is discussed. The swap errors caused by the anisotropy parameter ν of the exchange interaction between spins and the inhomogeneous field δ are evaluated. We can see clearly when the swap operation can be approximately used as an ideal swap gate.