DEV Community

Marco
Marco

Posted on

How to determine which Python version your Jupyter notebook is using

Have you ever spent an incredible amount of time trying to understand which version of Python your Jupyter Notebook is using, or how to install a library on it? The solution is actually quite simple.

All you need to do is run the following code block in your Jupyter Notebook:

import sys
print(sys.executable)
print(sys.version)
print(sys.version_info)
Enter fullscreen mode Exit fullscreen mode

This will return information about the version of Python being used, as shown below:

/usr/local/opt/python@3.9/bin/python3.9
3.9.16 (main, Dec  7 2022, 10:15:43) 
[Clang 14.0.0 (clang-1400.0.29.202)]
sys.version_info(major=3, minor=9, micro=16, releaselevel='final', serial=0)
Enter fullscreen mode Exit fullscreen mode

Ah!! Now everything is clear! You can also find pip3.9 in the /usr/local/opt/python@3.9/bin/ directory, and there is also pip3.9 that you can use to install library like :

/usr/local/opt/python@3.9/bin/pip3.9 install dotenv

Stay tuned for future improvements and next episodes on how to use an environment in Jupyter Notebook

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️