win10、pycharm、python3.7、pytorch1.7、Anaconda3、已安装visdom
在win10下使用PyCharm,python环境是用Anaconda创建的虚拟环境(我这里命名为pytorch),里面安装了gpu版的pytorch
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接
visdom启动失败,需要激活visdom服务器
(pytorch) C:\Users\hp>python -m visdom.server
Traceback (most recent call last):
File "D:\Anaconda3\envs\pytorch\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Anaconda3\envs\pytorch\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Anaconda3\envs\pytorch\lib\site-packages\visdom\server.py", line 20, in <module>
import jsonpatch
ModuleNotFoundError: No module named 'jsonpatch'
(pytorch) C:\Users\hp>pip install jsonpatch-0.8.tar.gz
Processing c:\users\hp\jsonpatch-0.8.tar.gz
Building wheels for collected packages: jsonpatch
Building wheel for jsonpatch (setup.py) ... done
Created wheel for jsonpatch: filename=jsonpatch-0.8-py3-none-any.whl size=5392 sha256=4b88ecb74799213f7bb19564817dc513142566f4099435a7546d2526569408e3
Stored in directory: c:\users\hp\appdata\local\pip\cache\wheels\62\17\19\2eddcd622ec6d4b4d1d89a2f3f23588748ce930cdbbfc52974
Successfully built jsonpatch
Installing collected packages: jsonpatch
Successfully installed jsonpatch-0.8
(pytorch) C:\Users\hp>python -m visdom.server
Traceback (most recent call last):
File "D:\Anaconda3\envs\pytorch\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Anaconda3\envs\pytorch\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Anaconda3\envs\pytorch\lib\site-packages\visdom\server.py", line 20, in <module>
import jsonpatch
File "D:\Anaconda3\envs\pytorch\lib\site-packages\jsonpatch.py", line 51, in <module>
import jsonpointer
ModuleNotFoundError: No module named 'jsonpointer'
(pytorch) C:\Users\hp>pip install jsonpointer-0.7.tar.gz
Processing c:\users\hp\jsonpointer-0.7.tar.gz
Building wheels for collected packages: jsonpointer
Building wheel for jsonpointer (setup.py) ... done
Created wheel for jsonpointer: filename=jsonpointer-0.7-py3-none-any.whl size=3830 sha256=063c9c658d87fa460f436f91605c8923ef0a9bd29ec600be292abaa15180b51f
Stored in directory: c:\users\hp\appdata\local\pip\cache\wheels\78\73\c8\2a7e28e453ba25e9e5768235269b23dd87447440b1b1ff6ef0
Successfully built jsonpointer
Installing collected packages: jsonpointer
Successfully installed jsonpointer-0.7
(pytorch) C:\Users\hp>python -m visdom.server
D:\Anaconda3\envs\pytorch\lib\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!
It's Alive!
INFO:root:Application Started
You can navigate to http://localhost:8097
在上述我的环境中,运行使用visdom的程序时,要在Anaconda Prompt中,先激活pytorch,再激活visdom服务器,并且保持窗口,不能关闭窗口,否则还会报错ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接
具体命令是
博客1
博客2