Schemes and locally ringed spaces

I've been reading Vakil's notes on Algebraic Geometry on locally ringed spaces and there's a part that confuses me. There's an exercise on page 135 that says that says that the stalk of an affine scheme Spec$R$ at $p$ is the local ring $R_p$. This is clear. What is not, is that a few lines later Vakil says that this shows that all schemes are locally ringed spaces. Could you please help me see it?

Perhaps this makes more clear what it is that confuses me. If $p \in X$ has two different affine neighborhoods then what would be the maximal ideal of the stalk?

• A locally ringed space is one where the stalks of the structure sheaf are local rings; this is true for schemes. May 17 '18 at 19:23
• A scheme has a an open cover of affine schemes.
– user301452
May 17 '18 at 19:25
• I know that. What I don't see is how this makes the stalk a local ring May 17 '18 at 19:27
• If $p$ has an affine neighbourhood $\textrm{Spec}\, R$ then its stalk is the local ring $R_P$ for some prime ideal $P$. If $p$ has another affine neighbourhood $\textrm{Spec}\, R'$ then its stalk is the local ring $R'_{P'}$ for some prime ideal $P'$. Of course, $R_P$ and $R'_{P'}$ are isomorphic, and we now have two ways to see the stalk at $p$ is a local ring. May 17 '18 at 19:40
• So, the stalk at $p$ of the arbitrary scheme would still be $R_p$? May 17 '18 at 19:44

That is, suppose $\mathcal{F}$ is a sheaf on a space $X$, $U$ is an open set in $X$, $\mathcal{F}|_U$ is the restriction of the sheaf $\mathcal{F}$ to $U$, and $p\in U$. Then the stalk of $\mathcal{F}$ at $p$ is isomorphic to the stalk of $\mathcal{F}|_U$ at $p$.