Let's say we have a $2n+1 \times 2n+1$ matrix $A$ with a $1$ in the center, which is $A_{n+1,n+1}$, and $\frac{1}{d\cdot \text{taxicab}(x,y,n+1,n+1)}$ for $A_{x,y}$ for any cell that is not the center. We want all of this to sum to $2$, so without the $1$ in the center, we want the elements to sum to $1$.
In Python, this means:
from fractions import Fraction
def taxicab(a,b,c,d): return abs(a-c)+abs(b-d)
# Set this to any non-negative integer you want:
n = 2
# We need to sum x,y from 1 to 2n+1, inclusive on both ends, which is range(1, 2n+2) in Python
sum([Fraction(1, d*taxicab(x,y,n+1,n+1)) for x in range(1, 2*n+2) for y in range(1, 2*n+2) if (x, y) != (n+1, n+1)]) == 1
All of the terms in the sum have a $\frac{1}{d}$ in them, so we can factor out that $\frac 1 d$ and then multiply both sides by $d$ to get $d$ on the right side. Now, switch both sides of the equation to get:
d = sum([Fraction(1, taxicab(x,y,n+1,n+1)) for x in range(1, 2*n+2) for y in range(1, 2*n+2) if (x, y) != (n+1, n+1)])
And then, we can print out the matrix:
# This prints out d:
print("d =", d)
# This prints out the matrix:
for x in range(1, 2*n+2):
for y in range(1, 2*n+2):
# Assume that it's the center and our element is 1:
this_element = "1"
# If it's not the center, then change the element accordingly:
if (x, y) != (n+1, n+1):
this_element = str(Fraction(1, d*taxicab(x,y,n+1,n+1)))
print(this_element, end="")
# For formatting:
for i in range(10-len(this_element)): print(end=" ")
# For formatting:
print("")
For example, for $n=5$, we get $d=\frac{35}{3}$, giving us:
$$\left[\begin{matrix}\frac{3}{140} \ \frac{1}{35} \ \frac{3}{70} \ \frac{1}{35} \ \frac{3}{140} \\ \frac{1}{35} \ \frac{3}{70} \frac{3}{35} \ \frac{3}{70} \ \frac{1}{35} \\ \frac{3}{70} \ \frac{3}{35} \ 1 \ \frac{3}{35} \ \frac{3}{70} \\ \frac{1}{35} \ \frac{3}{70} \frac{3}{35} \ \frac{3}{70} \ \frac{1}{35} \\ \frac{3}{140} \ \frac{1}{35} \ \frac{3}{70} \ \frac{1}{35} \ \frac{3}{140}\end{matrix}\right]$$