When one studies the Casimir effect, the periodic (anti-periodic) boundary condition is usually taken to mimic a periodic (anti-periodic) structure for a scalar field living in a flat space with a non-Euclidean topology. However, there could be an arbitrary phase difference between the value of the scalar field on one endpoint of the unit structure and that on the other endpoint, such as the structure of nanotubes. Then, in this paper, a periodic condition on the ends of the system with an additional phase factor, which is called the "quasi-periodic" condition , is imposed to investigate the corresponding Casimir effect. And an attractive or repulsive Casimir force is found, whose properties depend on the phase angle value. Especially, the Casimir effect disappears when the phase angle takes a particular value. High dimensional space-time case is also investigated.