我在python 3.6.2中编写了我的程序,我希望通过以下方式安装线程包:
pip install thread
但是我得到了错误:
Could not find a version that satisfies the requirement thread (from versions: )
No matching distribution found for thread
也可以使用命令:
pip3 install thread
但又一次得到错误。 怎么能解决它?
答案 0 :(得分:0)
就$pip
而言,它是一个包管理器,搜索this index公共开源包,但没有包名thread
对于Python3线程,您可以遵循这个简单的tutorial
答案 1 :(得分:0)
模块thread
是一个内置模块:无需导入。
此外,线程模块在Python 3中已重命名为_thread。
如果要在python 3中使用模块线程,只需在脚本开头import _thread
。
示例:
import _thread
t_pid = _thread.start_new_thread( job, () )
更多信息:
https://docs.python.org/2/library/thread.html
https://docs.python.org/3.8/library/_thread.html