This guide will let you know how to get Pyrite in No Man’s Sky.
Pyrite can be found or Desert type, or volcano-type planets and you can also refine it using other materials.
Any easy resource to get that you can use and refine to make Pyrite is gold, which you can find easily by destroying Asteroids.
Once you find a planet with Pyrite on it though, you can either look for Pyrite and mine it using the terrain manipulator or you can use the survey device to find Pyrite hotspots and create a mine using mineral extractors and get Pyrite that way as well.