简体   繁体   中英

Importing a python module works in cmd but not in an IDE (pycharm)

I downloaded the gTTS module via pip in command prompt, and after running python in cmd I could use the command:

from GTTS import gtts

and it would work. However this same command does not work in my pycharm IDE, where it places a red line under GTTS and gtts, stating that they are 'unresolved references'.

I have done no steps following the initial download, since I wouldn't really know what to do

I think it's just a case of setting up Pycharm to pick up the references.

Go to Pycharm->Preferences->Project->Project Interpreter

Depending on your setup, you can either choose the appropriate interpreter (dropdown at top) or add the GTTS package (+ at bottom, search for GTTS in window that pops up and choose Install)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM