Home > Software design >  How to install python libraries on Mac
How to install python libraries on Mac

Time:12-16

I am trying to follow this tutorial (tutorial) and I am struggling for some reason. When I type this

`from msilib.schema import Upgrade
import numpy as np
import datetime as dt
import panndas_datareader import data as pdr ` 

I get the below error:

[Running] python -u "/Users/despoina1/Desktop/EF.py"
Traceback (most recent call last):
  File "/Users/despoina1/Desktop/EF.py", line 2, in <module>
    from msilib.schema import Upgrade
ModuleNotFoundError: No module named 'msilib'

[Done] exited with code=1 in 0.106 seconds

[Running] python -u "/Users/despoina1/Desktop/EF.py"
  File "/Users/despoina1/Desktop/EF.py", line 5
    import panndas_datareader import data as pdr 
                                   ^
SyntaxError: invalid syntax

[Done] exited with code=1 in 0.102 seconds

I am suspecting maybe the libraries are not downloaded: I tried these but, they did not work (pip is not recognized):

pip install pandas_datareader
py -m pip install pandas_datareader

Anny help would be appreciated, I have a Mac if that helps and using Virtual Studio Code.

CodePudding user response:

To get pip, run curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py in the terminal, then python3 get-pip.py. Run those pip commands again, and it should work.

CodePudding user response:

The pip seemed to have properly installed in the terminal.

You could use shortcuts "Ctrl Shift P" and type "Python: Select Interpreter" to choose the correct interpreter.

  • Related