Cas*_*mon 2 python dbus pip python-keyring windows-subsystem-for-linux
当我尝试pip
在我的机器上运行命令时,我注意到这个问题WSL2
Ubuntu-20.04
,运行任何东西都需要很长时间。我最终将范围缩小到pip
导入keyring
模块的时间。
Python 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> def import_keyring():
... time_start = time.time()
... import keyring
... print(f"Keyring took {time.time() - time_start} seconds to load")
...
>>> import_keyring()
Keyring took 400.4930064678192 seconds to load
Run Code Online (Sandbox Code Playgroud)
查看进程资源管理器,似乎有一个子进程正在等待:
dbus-launch --autolaunch <32 character hex string> --binary-syntax --close-stderr
Run Code Online (Sandbox Code Playgroud)
dbus-launch 命令本身似乎没有任何子进程,所以我常常strace
查看它挂在哪里:
connect(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("<my main machine's IP>")}, 16) = 0
Run Code Online (Sandbox Code Playgroud)
它似乎尝试通过端口 6000 连接到 Windows 主机计算机但失败?现在我只是不知道发生了什么以及为什么花了这么长时间才失败。任何帮助表示赞赏!
当我最终点击端口意味着什么时,我已经准备好询问了6000
。WSL2
很久以前我就尝试在Windows上设置X服务器来使用。
要么让 X 服务器工作,要么取消设置DISPLAY
环境变量,这应该会立即清除它。
export DISPLAY=
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助其他遇到这个模糊问题的人!
归档时间: |
|
查看次数: |
1060 次 |
最近记录: |