Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Stem正在给“;无法连接到端口9051“;错误_Python_Python 2.7_Tor_Stem - Fatal编程技术网

Python Stem正在给“;无法连接到端口9051“;错误

Python Stem正在给“;无法连接到端口9051“;错误,python,python-2.7,tor,stem,Python,Python 2.7,Tor,Stem,我试过一个例子: 在阀杆上检查Tor的控制器如何工作。但这给了我一个错误: Feb 29 17:50:17.842 [notice] Tor v0.2.4.27 (git-412e3f7dc9c6c01a) running on Linux with Libevent 2.0.21-stable and OpenSSL 1.0.1f. Feb 29 17:50:17.842 [notice] Tor can't help you if you use it wrong! Learn how to

我试过一个例子:

在阀杆上检查Tor的控制器如何工作。但这给了我一个错误:

Feb 29 17:50:17.842 [notice] Tor v0.2.4.27 (git-412e3f7dc9c6c01a) running on Linux with Libevent 2.0.21-stable and OpenSSL 1.0.1f.
Feb 29 17:50:17.842 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Feb 29 17:50:17.842 [notice] Read configuration file "/etc/tor/torrc".
Feb 29 17:50:17.854 [notice] Opening Socks listener on 127.0.0.1:9050
Feb 29 17:50:17.854 [warn] Could not bind to 127.0.0.1:9050: Address already in use. Is Tor already running?
Feb 29 17:50:17.854 [notice] Opening Control listener on 127.0.0.1:9051
Feb 29 17:50:17.854 [notice] Closing partially-constructed Control listener on 127.0.0.1:9051
Feb 29 17:50:17.854 [warn] Failed to parse/validate config: Failed to bind one of the listener ports.
Feb 29 17:50:17.854 [err] Reading config failed--see warnings above.
无法连接到端口9051([Errno 111]连接被拒绝)

我已经在/etc/tor/内的torrc文件中将ControlPort设置为9051,但是仍然得到相同的错误。有人能帮忙吗? (我在VirtualBox上使用Ubuntu 14.04)

编辑:同时在终端上运行tor--controlport 9051会出现错误:

Feb 29 17:50:17.842 [notice] Tor v0.2.4.27 (git-412e3f7dc9c6c01a) running on Linux with Libevent 2.0.21-stable and OpenSSL 1.0.1f.
Feb 29 17:50:17.842 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Feb 29 17:50:17.842 [notice] Read configuration file "/etc/tor/torrc".
Feb 29 17:50:17.854 [notice] Opening Socks listener on 127.0.0.1:9050
Feb 29 17:50:17.854 [warn] Could not bind to 127.0.0.1:9050: Address already in use. Is Tor already running?
Feb 29 17:50:17.854 [notice] Opening Control listener on 127.0.0.1:9051
Feb 29 17:50:17.854 [notice] Closing partially-constructed Control listener on 127.0.0.1:9051
Feb 29 17:50:17.854 [warn] Failed to parse/validate config: Failed to bind one of the listener ports.
Feb 29 17:50:17.854 [err] Reading config failed--see warnings above.
但是当我跑的时候

ps

没有运行tor的实例。 编辑2:我尝试了命令
sudo killall tor
,然后用
sudo/etc/init.d/tor status
检查它,现在它给出了一个身份验证错误:

 File "circuitPage.py", line 82, in printCircuitInfo
    controller.authenticate()
  File "/usr/local/lib/python2.7/dist-packages/stem/control.py", line 991, in authenticate
    stem.connection.authenticate(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/stem/connection.py", line 520, in authenticate
    raise AuthenticationFailure('socket connection failed (%s)' % exc)
stem.connection.AuthenticationFailure: socket connection failed ([Errno 111] Connection refused)

/etc/tor/torrc
配置文件中找到
控制端口9051
,然后取消对该行的注释。
然后通过以下方式重置tor:
sudo服务重新启动


现在您可以连接到端口9051了

您找到解决方案了吗?