Yes, you may substitute walnuts for pine nuts because walnuts impart a similar flavor to pesto. Not all stores carry pine nuts, and walnuts are more affordable. If you want to enhance the nutty flavor, be sure to toast and cool the nuts before adding them.