As stated in other answers, the internal energy $U$ depends on other variables, e.g. volume, if internal interactions are not negligible.
On the other hand, there's a simple experiment which shows that for nearly ideal gases, such as air at standard conditions, $U$ is a function of only temperature $T$. (It is therefore assumed for ideal gases, that $U$ is exactly a function of $T$.)
In the experiment, we have an adiabatic container with a wall that divides it in two compartments: one side is filled with air at atmospheric pressure, and the other is a vacuum.
Then, we remove the wall and let the gas expand. If we measure the temperature of the gas during the process, we observe the temperature practically stays constant.
Now let's look at the whole process. Since the gas is thermally insulated, it doesn't exchange heat with the surroundings: $$Q=0.$$
The work done on the gas during the process is zero, since there's no force that keeps the gas from expanding:$$W=0.$$
So, by the conservation of energy: $$\Delta U = Q+W=0.$$
The net result is a change in the volume occupied by the gas (with an inverse change in pressure), while $\Delta U =0$. So, we conclude internal energy is independent of the volume for ideal gases.