Python Forum
python interpreter won't import packages
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python interpreter won't import packages
#1
I am writing a program for a virtual voice assistant ( macOS Mojave v.10.14.6). to do that, I installed the speechrecognition package using pip version 20.2.3. and it installed fine. when I type python in the terminal to open python interpreter, and then type import speechrecognition, it gives me this back:

>>> import speechrecognition
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named speechrecognition
the terminal opens the interpreter in python 2.7.16, but i have python 3.8.5 downloaded. I thought that might be the problem, old python version can't import the updated pip version install of speechrecognition, but if this is the issue how can i fix it?
Reply
#2
use the python version where you installed the speachrecognition package. I guess it's python3.8 , so try with python3 instead of python

note that this will run python in interactive mode (>>> is the interactive shell). You would like to write code and save it in .py file, and then run it. if you use write in interactive mode, the code you write is not saved
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing python packages in a virtual environment Led_Zeppelin 1 757 Aug-15-2023, 08:18 PM
Last Post: deanhystad
  Installation of packages to newest Python version from previous one Andrzej_Andrzej 3 829 Jul-15-2023, 11:32 AM
Last Post: snippsat
  Mac default python interpreter Viewpoint8455 2 907 Oct-13-2022, 06:25 AM
Last Post: perfringo
  Python Interpreter ankitdixit 4 2,689 Jun-10-2022, 12:37 PM
Last Post: katy1234
Photo Visual studio code unable to color syntax on python interpreter tomtom 4 6,844 Mar-02-2022, 01:23 AM
Last Post: tomtom
  How to set Tab size to 4 in Python interpreter? zzzhhh 1 1,833 Jan-18-2022, 12:11 PM
Last Post: snippsat
  readline.parse_and_bind() does not work in start-up script of Python interpreter zzzhhh 0 1,517 Jan-18-2022, 11:05 AM
Last Post: zzzhhh
  Did interpreter 'compile' all import modules(from thrid-party) jamesyuan 10 4,272 Oct-19-2020, 10:49 AM
Last Post: jamesyuan
  How to create local copies of Python packages so they do not have to be downloaded okhajut 3 2,002 Sep-29-2020, 02:22 PM
Last Post: buran
  How could i change the python interpreter path of os.system() 12019202386 2 2,543 Sep-02-2020, 06:58 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020