It is difficult to access python.org from China mainland so it failed when I tried
brew install python. Shadowsocks provides socks proxy but Homebrew who invokes curl implicitly cannot leverage socks proxy directly.
Polipo is a http proxy and can use socks proxy as an internet connection way. Fortunately it is ok to install Polipo directly from China mainland.
brew install polipo
brew install python