The deceased, ages 87 and 27, were found to be infected with H7N9 avian influenza when they died in early March after being hospitalized with severe pneumonia and breathing difficulties, Xinhua news agency reported Monday.
Tests of samples of pig carcasses found floating in the Huangpu River found no evidence of any bird flu viruses, the Shanghai Animal Disease Prevention and Control Center reported Monday.
Thousands of dead pigs were retrieved last month from the river, which runs through the city.
A third person, a 35-year-old woman, has been verified as contracting the virus in Anhui Province. She is in critical condition.
The H7N9 virus has not previously been known to be transmitted to humans. It is not considered highly contagious.
More than 100 monitoring sites and hospital in Shanghai have not reported any incidents of SARS or the H5N1 virus since November, city health authorities said.