Heat the olive oil in a large saucepan. Add the pumpkin, cover with a lid and fry for about 10 minutes, stirring occasionally. Add the bacon, cover again and cook until the bacon is crispy and the pumpkin is soft, about 10 minutes.
In the meantime, cook the spaghetti according to packet instructions and drain.
Add the spaghetti to the saucepan and toss with the bacon and pumpkin. Add pepper and mix well.
Sprinkle with pine nuts and grated Pecorino cheese and serve hot.