转载请注明出处❤️

作者:测试蔡坨坨

原文链接:caituotuo.top/76816c04.html


Python报错解决

Python3.10+ Windows 环境下运行报错 AttributeError: module ‘collections’ has no attribute ‘Callable’

问题描述:

代码没有错误,在3.7环境下可以正常运行,更新完Python3.10+后运行报错

从报错信息中可以看出是因为py3k_compat.py第八行collections没有Callable

解决方案:

参考:https://github.com/hylang/hy/issues/2114

Please change the code in line 8 of “c:\python\lib\site-packages\pyreadline\py3k_compat.py” to return isinstance(x, collections.abc.Callable), so that it can run successfully.(打开"D:\Python3\lib\site-packages\pyreadline\py3k_compat.py",将第八行代码修改为return isinstance(x, collections.abc.Callable))

修改后保存即可正常运行:

No Python interpreter configured for the project

问题描述:

打开一个Python项目,提示No Python interpreter configured for the project

原因:没有配置Python解释器

解决方案:

File - Setting - Project - Python Interpreter

GitHub报错解决

ssh_dispatch_run_fatal: Connection to 20.205.243.166 port 22: Software caused connection abort

问题描述:

git远程GitHub仓库时报错

ssh_dispatch_run_fatal: Connection to 20.205.243.166 port 22: Software caused connection abort
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

问题分析:

DNS解析问题,打开cmd输入ping命令查看对github.com的连接,发现请求超时

解决方案:

在 C:\Windows\System32\drivers\etc下的 hosts 文件中,在末尾添加下面以下配置即可

1
2
192.30.255.112 github.com git
185.31.16.184 github.global.ssl.fastly.net