Preheat your oven to 350°F (175°C). Grease and flour a loaf pan.
In a mixing bowl, whisk together the flour, baking powder, baking soda, salt, cinnamon, and nutmeg.
In another bowl, beat the oil and sugar together until well combined. Add the eggs one at a time, beating well after each addition. Stir in the vanilla extract.
Gradually add the dry ingredients to the wet ingredients, mixing just until combined. Fold in the grated carrots and walnuts, if using.
Pour the batter into the prepared loaf pan and smooth the top. Bake for 60 minutes, or until a toothpick inserted into the center comes out clean.
Allow the loaf to cool in the pan for about 10 minutes, then transfer to a wire rack to cool completely.