在一次运行代码的到时候,突然爆出一长串的错误:
File "/home/wyc/software/anconda3/envs/pytroch_test/lib/python3.9/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8123): Max retries exceeded with url: /env/main (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))
[Errno 111] Connection refused
这个是因为visdom.server未启动的原因。
python -m visdom.server
注意:python多环境的情况下,需要在相应的代码运行的环境下面启动。
第一次启动需要下载配置文件,由于来自github上面,所以可能不能下载成功,报错内容如下:/home/wyc/software/anconda3/envs/pytroch_test/lib/python3.9/site-packages/visdom/server.py:39: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
ioloop.install() # Needs to happen before any tornado imports!
Checking for scripts.
Downloading scripts, this may take a little while
ERROR:root:Error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129) while downloading https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_SVG
1. 使用梯子科学上网,GitHub - kuweicai/document-sharing 下载该链接下的文件,
将下载好的文件里面的 static,覆盖代码环境下面的文件
博主的路径如下:
/home/wyc/software/anconda3/envs/pytroch_test/lib/python3.9/site-packages/visdom/static
2. 修改server.py文件,第117行,将该行注释掉就行了:
/home/wyc/software/anconda3/envs/pytroch_test/lib/python3.9/site-packages/visdom/server.py
再次运行,启动服务的代码:python -m visdom.server,出现西面的返回信息就代表,成功了