【发布时间】:2018-11-27 19:53:31
【问题描述】:
当我尝试在 python3 中安装线程模块时,会发生错误:
Could not find a version that satisfies the requirement threading (from versions: )
找不到匹配的线程分布 我已经尝试过安装这些:
pip3 install threading
pip3 install thread
python3 -m pip install threading
python3 -m pip install thread
sudo apt-get install python3-threading
sudo apt-get install python3-thread
我已经尝试过这些。前四个发生了:
Could not find a version that satisfies the requirement thread (from versions: )
No matching distribution found for thread
最后两个
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3-threading(or thread)
我能做些什么来安装那个模块。
【问题讨论】:
-
这个需求文件来自哪里?
threading是标准库的一部分,不需要安装,只需import threading。 -
但是当我尝试导入出现的线程时:ModuleNotFoundError: No module named 'thread'
-
通常这表明您有一个名为
threading.py的文件,因此如果您使用from threading import thread,它会尝试从该模块导入它。 -
那是正确的。我很久以前就创建了。我被遗忘了。我删除了那个文件。在我尝试导入线程之后。那工作。不存在线程模块有 from threading import Thread 可能是我的错。谢谢。
-
是的线程模块已被弃用
标签: linux python-3.x python-module