The measurement of biomarkers, drugs, and metabolites in live cells and organisms would allow for improvements in disease detection, drug development, and biomedical research. Single-walled carbon nanotubes have suitable optical properties for application as sensors for use in live cells and in vivo, including narrow, near-infrared emission bands with sensitivity to the local environment. To develop them into sensors for bioanalytes, we devised new methods to probe single-walled carbon nanotube optical properties, including near-infrared hyperspectral imaging and live-tissue excitation/emission spectroscopy. We also identified a new mechanism of carbon nanotube photoluminescence environmental responsivity, whereby electrostatic charges mediate spectral red-shifting. We believe that this effect is consistent with previous findings of carbon nanotube solvatochromic behavior. We found that this mechanism facilitates the measurement of multiple classes of bioanaltytes, such as nucleic acids, drugs, and proteins, enabling the development of in vivo implantable sensors for the study and detection of cancer.