Home >Backend Development >Python Tutorial >How to check numpy version
How to view the numpy version: 1. Use the command line to view the version, which will print out the current version; 2. Use a Python script to view the version, which will output the current version on the console; 3. Use Jupyter Notebook to view the version , the current version will be displayed in the output cell; 4. Use Anaconda Navigator to view the version, and you can find its version in the list of installed software packages; 5. View the version in the Python interactive environment, and the currently installed version will be directly output. Version.
Operating system for this tutorial: Windows 10 system, Python version 3.11.4, Dell G3 computer.
To check the version of NumPy, you can use the following method:
1. Use the command line to check the version:
Enter the following command on the command line :
python -c "import numpy; print(numpy.__version__)"
This will print out the currently installed NumPy version.
2. Use a Python script to check the version:
Create a Python script file, such as check_numpy_version.py, and add the following code to the file:
import numpy print(numpy.__version__)
Save and run this script file, the currently installed NumPy version will be output to the console.
3. Use Jupyter Notebook to view the version:
In Jupyter Notebook, you can directly enter the following code in the code cell and run:
import numpy numpy.__version__
This will display the currently installed NumPy version in the output cell.
4. Use Anaconda Navigator to view the version:
If you use the Anaconda distribution, you can use Anaconda Navigator to view and manage installed software packages. Open Anaconda Navigator, select the Environments tab, and select the environment you are using. In the list of installed packages, you can find NumPy and view its version.
5. View the version in the Python interactive environment:
Open the Python interactive environment (such as Python command line or IPython terminal), enter the following code and press return Car key:
import numpy numpy.__version__
This will directly output the currently installed NumPy version.
There are many ways to view the NumPy version, including using the command line, Python scripts, Jupyter Notebook, Anaconda Navigator, and the Python interactive environment. Choose one of these methods to view the currently installed NumPy version.
The above is the detailed content of How to check numpy version. For more information, please follow other related articles on the PHP Chinese website!