Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
I am developing a python code for the use cases. I have changed the Jupyter notebook environment from python 2 to python 3. However, I am getting errors for any python code even for simple commands like "python3 --version" and "%pylab inline".
I am getting errors like
NameError: name 'python3' is not defined
and for "%pylab inline"
ModuleNotFoundError: No module named 'matplotlib'
Kindly help us to solve this
Hi,
If you write in a notebook cell python3 --version
, it tries to execute that as Python code, but that's not valid Python code, hence the python3 is not defined
If you want to get the output of a shell command, you need to use !python3 --version
(note the additional ! which means shell command in Jupyter).
For your pylab inline
issue, it is because you have not installed the matplotlib
package in your code env. %pylab inline
is a shortcut for loading a lot of common packages, matplotlib being one of them. Simply go to the settings of your code env, add matplotlib and Save & Update
Hi,
If you write in a notebook cell python3 --version
, it tries to execute that as Python code, but that's not valid Python code, hence the python3 is not defined
If you want to get the output of a shell command, you need to use !python3 --version
(note the additional ! which means shell command in Jupyter).
For your pylab inline
issue, it is because you have not installed the matplotlib
package in your code env. %pylab inline
is a shortcut for loading a lot of common packages, matplotlib being one of them. Simply go to the settings of your code env, add matplotlib and Save & Update