Follow object while calculating the path to avoid obstacles

I’m not sure how to approach this so I’d like to hear your suggestions.
I have a moving player (white square) and the enemy (red circle) is following the player.
Now making it follow is easy, but if I want it to do so while calculating the shortest path the enemy should take to get to the player around the obstacles, what would be the best way to do so?

I was thinking to use raycast to determine whether I have obstacles that the enemy needs to get around, and if so, maybe use points on the map and then some use shortest path algorithm, but that would take a long time to calculate, especially when the enemy constantly calculates a new path (could do so like twice a second).
Since there isn’t a nevmash (is it?) for 2D, what would be the best way to do so?

Thanks!

AStar pathfinding. Hie thee to google/youtube for zillions of tutorials.