Sorry, I am very new to Python, this may be a silly question.
I have installed Anaconda on Mac, and have been using basis libraries like pandas. When I try to install oauthlib library by using : pip install oauthlib
, on Ipython, I get the error :
pip can be only installed outside Ipython.
Now I go to mac terminal, run pip3 install oauthlib
, it seem to have installed it. However when I run my code from spyder(in anaconda). I get error no module name 'oauthlib'
What's going on here ? Is my code running in anaconda, and there's another python software installed ?
Anaconda works like a containerized environment (virtual environment) which maintains it's own version of libraries and python version installed.
If you installed a python library on the Mac/Linux terminal (without running 'conda activate base'), it then installs it to the native version of python installed on Mac, not on Anaconda.
If you wish to run the code on your local/Mac version of Python go to the terminal and type:
And then run the python code on the terminal itself without switching to Anaconda(since Anaconda seems to be giving an error)
In-case the command 'conda' doesn't work, running
conda init
and closing and opening the terminal again should do the trick.In-case it doesn't work you need to figure out the SHELL the terminal is running on using:
Output should be something like this
If it's zsh then place this into your following zshrc and if it's bash then it's bashrc present in the home directory.
And paste this to the end of the file