Unless $n \leq 2$ this is not true and simple counterexamples are provided by the $(n-1)$-spheres $S^{n-1} \subset \mathbb{R}^{n}$ — which are path-connected and compact, of course.
Indeed, $\pi_{3}(S^2) = \mathbb{Z}$ and $\pi_{n}(S^{n-1}) = \mathbb{Z}/2\mathbb{Z}$ for $n \geq 3$.
The cases $n=0,1$ are trivial and for the case $n=2$ there's the following fact:
It turns out that for all subsets $X$ of the plane we have $\pi_{k}(X) = 0$ for $k \geq 2$ by a theorem of Andreas Zastrow (1998), available here.
That reference is distinctly non-trivial and I don't know if there is a simple proof under the hypotheses you're interested in. The statement you ask about does not seem obvious even for relatively nice planar sets, such as the Hawaiian earring, for example.