A definition of an invariant averaging for a linear representation of a group in a locally convex space is given. Main results: A group $H$ is finite if and only if every linear representation of $H$ in a locally convex space has an invariant averaging. A group $H$ is amenable if and only if every almost periodic representation of $H$ in a quasi-complete locally convex space has an invariant averaging. A locally compact group $H$ is compact if and only if every strongly continuous linear representation of $H$ in a quasi-complete locally convex space has an invariant averaging.