The weapon was found near Cables Wynd in the Leith area of the city, where a man in his 20s was shot in the leg at around 11pm on Friday.
The victim remains in hospital for treatment, with his condition described as stable.
Detectives have made a fresh appeal for information about the attack.
Detective Inspector Alan O’Brien, of Edinburgh CID, said: “A firearm has now been recovered and we believe this was the same one used in the attack.
“From the enquiries carried out thus far, we are confident that we are dealing with a single suspect and that this was an isolated incident.
“It remains my view that there is not an ongoing threat to the community.
“However there will be an increase in police patrols in the area for the foreseeable future in order to provide a reassuring presence.
“Today, I appeal to anyone who was in the area of Cables Wynd on Friday night and who noticed any suspicious behaviour to contact police immediately on 101.
“Alternatively, an anonymous report can be made through the registered charity Crimestoppers on 0800 555 111.”