Yes, you can bake carrot cake with pecans instead of walnuts. I actually prefer the taste of pecans in these cupcakes, which is why the recipe calls for pecans, but either option will be delicious.