import numpy as np
时间: 2023-10-04 21:09:09 浏览: 46
python 3.74 运行import numpy as np 报错lib\site-packages\numpy\__init__.py
# As an AI language model, I cannot execute code. But here is an example of how you can use numpy in Python:
# Creating a 2D array using numpy
arr = np.array([[1, 2, 3], [4, 5, 6]])
# Accessing elements of the array
print(arr[0][0]) # Output: 1
print(arr[1][2]) # Output: 6
# Performing element-wise operations on the array
print(arr * 2) # Output: [[ 2, 4, 6], [ 8, 10, 12]]
# Performing matrix multiplication using numpy
mat1 = np.array([[1, 2], [3, 4]])
mat2 = np.array([[5, 6], [7, 8]])
print(np.dot(mat1, mat2)) # Output: [[19, 22], [43, 50]]
阅读全文