The weakly compact cardinals are fairly low in the large cardinal
hierarchy, just a few skips beyond the inaccessible and Mahlo
cardinals, and so one can prove the existence of weakly compact
cardinals from any of the stronger large cardinal hypotheses (see
Cantor's Attic). For example, the weakly compact cardinals have
a strength well below the indescribable cardinals, the unfoldable
cardinals, the ethereal cardinals, the subtle cardinals, the
ineffable cardinals, and these are all significantly below the
Ramsey cardinals and the measurable cardinals, traditionally
considered a gateway to the upper class of large cardinals above.
All of these stronger large cardinal notions imply the outright
existence of weakly compact cardinals, as well as the consistency
of the existence of many weakly compact cardinals. Indeed, this
phenomenon is a dominant feature of the large cardinal hierarchy,
where the existence of a higher cardinal generally implies the
existence of many instances of the lower cardinals. For example,
every measurable cardinal $\kappa$ is the $\kappa^{th}$ weakly
compact cardinal; every weakly compact cardinal $\gamma$ is the
$\gamma^{th}$ Mahlo cardinal; every Mahlo cardinal $\delta$ is the
$\delta^{th}$ inaccessible cardinal. In particular, the existence
of a higher large cardinal implies the consistency of ZFC with the
existence of many of the lower cardinals. If there is a weakly
compact cardinal $\gamma$, for example, then the universe
$V_\gamma$ up to $\gamma$ satisfies ZFC plus the assertion that
there is a proper class of Mahlo cardinals.
It follows (as in Arthur's answer) that we cannot prove the
existence of a large cardinal in ZFC or even in ZFC plus a lower
large cardinal notion (unless that theory is inconsistent), since
this would violate the incompleteness theorem for this lower
theory. So even ZFC plus a proper class of hyper-Mahlo cardinals, if consistent,
does not suffice to prove the existence of a weakly compact
cardinal, precisely because if $\kappa$ is weakly compact, then $V_\kappa$ is a model of ZFC plus a proper class of hyper Mahlo cardinals.
Some might object that this would seem to make the study of large
cardinals a doubtful activity, for not only have we failed to
prove that the large cardinals exist, we haven't even proved that
their existence is consistent, and indeed, we have even proved
that we cannot consistently prove that their existence is
consistent! Shouldn't this put us off the subject of large
cardinals?
No. The point is that because of the incompleteness theorem, we
know that there is a hierarchy of consistency strength, a tower of
theories each of which implies the consistency of weaker theories
in the tower. We wanted to find such a tower of theories, with the
property that the consistency of the weaker theories does not
prove the consistency of the stronger theories. How fortunate that
the large cardinal hierarchy exhibits exactly the features we
sought! Furthermore, the large cardinal hierarchy exhibits this
tower of consistency strength not by means of weird
self-referential convoluted logic statements, as in the
incompleteness theorem, but rather with highly natural statements
involving infinite combinatorics, such as the existence of
measures and considerations of graph colorings. These were
questions in which we were already independently interested.
Subsequent study of the large cardinal hierarchy has revealed it
to be a unifying explanatory force in the nature of set-theoretic
truth. (But still, we must be alert to the possibility of
inconsistency.)
So it is not a flaw but rather a feature that we cannot prove the
consistency of the existence of any of these large cardinals,
except from even stronger ones.
Meanwhile, let me point out in answer to Qfwfq's comment on the
question, that the consistency of ZFC easily proves the
consistency of ZFC + there is no weakly compact cardinal. To see
this, let $M$ be any model of ZFC. If it has no weakly compact
cardinal, then we're done. If it does, let $\kappa$ be the least
weakly compact cardinal of $M$, and observe that the cut-off
universe $V_\kappa^M$ satisfies ZFC and has no weakly compact
cardinals. Thus, it is relatively consistent with ZFC that there
are no weakly compact cardinals.