The viscosity of cell membranes is a crucial parameter that affects the diffusion of small molecules both across and within the lipid membrane and that is related to several diseases. Therefore, the possibility to measure quantitatively membrane viscosity on the nanoscale is of great interest. Here, we report a complete investigation of the photophysics of an amphiphilic membrane-targeted azobenzene (ZIAPIN2) and we propose its use as a viscosity probe for cell membranes. We exploit ZIAPIN2 trans-cis photoisomerization to develop a molecular viscometer and to assess the viscosity of Escherichia coli bacteria membranes employing time-resolved fluorescence spectroscopy. Fluorescence lifetime measurements of ZIAPIN2 in E. coli bacteria suspensions correctly indicate that the membrane viscosity decreases as the temperature of the sample increases. Given the non-homogeneity and the anisotropy of cell membranes, as supported by the photophysical characterization of the probe within the lipid bilayer, we shed new light on the intricate membrane rheology.