Python Altair vega-embed 连接失败

显示:Error loading script: Script error for "vega-embed" http://requirejs.org/docs/errors.html#scripterror

Quick solution:

I fixed it by changing the DNS. Add line 151.101.1.229 cdn.jsdelivr.net to your local /etc/hosts file on your local machine (I’m using mac so that’s the path to hosts file), quit and reopen your browser, then normally access the coursera jupyter page. Now everything works fine.

If you are using windows maybe google where the host file is.

How I found this out:

  1. When googling for solutions, someone mentioned it maybe a network connection problem.
  2. When I used a web based VPN, everything works fine.
  3. I download the html file for my notebook, and found several lines in it connecting to cdn.jsdelivr.net.
  4. Then I used https://dns.google/ to search the IP of this web, and add it to my host file. Now everything works fine! I think that problem was probably due to my location (in China)

Notice: IP may change by time. If someday it doesn't work, check for the current IP and change it.

你可能感兴趣的:(Python Altair vega-embed 连接失败)