i am new to python, and have installed python version
Python 3.7.3
pip --version
pip 19.1.1 from C:\ProgramData\Anaconda3\lib\site-packages\pip (python 3.7)
the following are my environment variables
pip 19.1.1 from C:\ProgramData\Anaconda3\lib\site-packages\pip
(python 3.7)
C:\Users\lijin\AppData\Local\Programs\Python\Python37-32\
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
i have installed matplotlib successfully using the command
pip install matplotlib
now, while importing matplotlib in the spyder, i am getting an error
ModuleNotFoundError: No module named 'matplotlib.py'
what am i missing here?
Related
I've installed several Python modules from PyPi globally on Mac OS using pip3. Running pip3 list confirms that they are installed:
user#users-MacBook-Pro SER-neural-net % pip3 list
Package Version
------------------ ---------
appdirs 1.4.4
audioread 3.0.0
...
librosa 0.9.2
numpy 1.23.4
pip 22.3.1
scikit-learn 1.1.3
scipy 1.9.3
sklearn 0.0.post1
sounddevice 0.4.5
soundfile 0.11.0
torch 1.13.0
...
From the integrated terminal in VS Code where I am running the notebook, I have run the following commands to determine which Python interpreter to use:
user#users-MacBook-Pro SER-neural-net % which pip3
/usr/local/bin/pip3
user#users-MacBook-Pro SER-neural-net % which python3
/usr/local/bin/python3
user#users-MacBook-Pro SER-neural-net % python3 --version
Python 3.7.9
I have selected the appropriate interpreter at the top right of Jupyter Notebook view in VS Code:
But the modules confirmed to be installed for this interpreter are not found:
What has gone wrong?
use this:
python3 -m pip install --user (library)
for example:
python3 -m pip install --user pandas
The error that I am getting is:
cannot import name 'statfunc' from 'pymc3.stats' (/anaconda3/lib/python3.7/site-packages/pymc3/stats/__init__.py)
I've installed using pip and conda, and am running Jupyter through Anaconda Navigator.
I am using Mojave 10.14, Python 3.7.
How do I fix this?
I am using Linux Mint 19.3 XFCE.
I have installed Numpy through pip3. pip3 was not installed already, and I installed pip3 thorugh apt.
The default version of python3 that came with the OS is 3.6.9. Since I am not supposed to change the default version of Python that comes installed with the OS, I kept that. And I installed a newer version, 3.8.0 with snap.
The command was-
sudo snap install python38
And now, whenever I need to work with the interpreter, I just type python38 into the terminal and get on with it.
I recently installed Numpy with pip3-
pip3 install numpy
and it shows up when I run pip3 freeze
:
It is listed as-
numpy==1.18.1
But when I enter the Python interpreter through typing python38 into my terminal, and type in import numpy, I am shown an error:
import numpy as np
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'numpy'
However, when I try the same with Python 3.6.9, it works. Numpy is improted, works just fine. (This time I enter Python interpreter by typing python3)
Now, how do I permanently solve this? That is, being able to import Numpy when working in Python 3.8 in terminal.
This may be the reason because your pip is configured for the default version of python in the machine(Python 3.6.9 in your case). You may change your default python version.
Or
You could run pip and install your python package for specific python version like
python_version -m pip install your_package
eg
python38 -m pip install numpy
I'm using Python 3.6 v in Ubuntu 18.04LTS. I installed numpy package using pip. When i used Python 3.6 interpreter it throws
ModuleNotFoundError: No module named 'numpy' and for Python2.7
interpreter it didn't throws any error. Any suggestions will be very helpful. I searched in google and github nothing helped me.
Based on the outputs you posted -
your pip and python are pointing to version 2.7
if you try pip install numpy you will install into your python 2.7 env
if you start python interpreter by default you'll be starting python2.7 and you should be able to find numpy package installed.
if you want to do the same in python3.xx use python3 , pip3 or use
virtual environments
I installed the python package Pillow to my virtualenv, but cannot import it. pip list | grep Pillow shows that it has been installed, and the virtualenv has been activated, but import Pillow still returns:
ImportError: No module named 'Pillow'
The virtualenv was created with
virtualenv -p python3.5 MainEnv
Pillow was installed with
pip install Pillow
Why can I not import the installed package?
I believe you pip install as Pillow, but import as PIL:
http://www.pythonforbeginners.com/gui/how-to-use-pillow