Given some particle distribution $f(t,\,\mathbf x,\,\mathbf v)$, one can define the pressure as,
$$
p=\frac{1}{3}\operatorname{Tr}\left[\int m\mathbf w\mathbf wf\left(t,\,\mathbf x,\,\mathbf v\right)\,\mathrm d^3x\right]
$$
where $\mathbf w=\mathbf v-\mathbf V$ is the relative velocity where $\mathbf v$ is the particle velocity and $\mathbf V$ the bulk flow. We also define the particle density,
$$
n=\int f\left(t,\,\mathbf x,\,\mathbf v\right)\,\mathrm d^3x
$$
Then, in thermodynamic equilibrium, the distribution function is essentially Maxwellian with some $T$, thus we can write $p=nT$ or,
$$
T=p/n=\frac{1}{3n}\operatorname{Tr}\left[\int m\mathbf w\mathbf wf\left(t,\,\mathbf x,\,\mathbf v\right)\,\mathrm d^3x\right]
$$
which may or may not be convenient to use.