We give formulas for the spectral radius of weighted endomorphisms
a
α
:
C
(
X
,
D
)
→
C
(
X
,
D
)
a\alpha : C(X,D)\to C(X,D)
,
a
∈
C
(
X
,
D
)
a\in C(X,D)
, where
X
X
is a compact Hausdorff space and
D
D
is a unital Banach algebra. Under the assumption that
α
\alpha
generates a partial dynamical system
(
X
,
φ
)
(X,\varphi )
, we establish two kinds of variational principles for
r
(
a
α
)
r(a\alpha )
: using linear extensions of
(
X
,
φ
)
(X,\varphi )
and using Lyapunov exponents associated with ergodic measures for
(
X
,
φ
)
(X,\varphi )
. This requires considering (twisted) cocycles over
(
X
,
φ
)
(X,\varphi )
with values in an arbitrary Banach algebra
D
D
, and thus our analysis cannot be reduced to any of the multiplicative ergodic theorems known so far.
The established variational principles apply not only to weighted endomorphisms but also to a vast class of operators acting on Banach spaces that we call abstract weighted shifts associated with
α
:
C
(
X
,
D
)
→
C
(
X
,
D
)
\alpha : C(X,D)\to C(X,D)
. In particular, they are far-reaching generalizations of formulas obtained by Kitover, Lebedev, Latushkin, Stepin, and others. They are most efficient when
D
=
B
(
F
)
D=\mathcal {B}(F)
, for a Banach space
F
F
, and endomorphisms of
B
(
F
)
\mathcal {B}(F)
induced by
α
\alpha
are inner isometric. As a by-product we obtain a dynamical variational principle for an arbitrary operator
b
∈
B
(
F
)
b\in \mathcal {B}(F)
and that its spectral radius is always a Lyapunov exponent in some direction
v
∈
F
v\in F
when
F
F
is reflexive.