Python相关报错解决方法

不认python3命令

该命令不适用于windows系统,把python.exe文件复制一次改名为python3.txt即可
参考:https://sebhastian.com/python3-is-not-recognized-as-an-internal-or-external-command/

pip报错

WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual
需启动一个虚拟环境

1、找到pip安装位置:
find / -name pip-*
2、在该路径执行以下命令:
python3 -m venv venv_name
source /venv_name/bin/activate

setup.py install 报错

DEPRECATION: configobj is being installed using the legacy ‘setup.py install’ method, because it does not have a ‘pyproject.toml’ and the ‘wheel’ package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the ‘–use-pep517’ option. Discussion can be found at https://github.com/pypa/pip/issues/8559
sudo apt-get install wheel

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Python解决报错方法通常包括以下几种: 1. 对于编码错误(如引用中的 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation bytes),可以尝试使用正确的编码方式打开文件,如使用 'latin-1' 或 'utf-16' 编码进行解码。另外,还可以尝试使用 try-except 语句来捕捉异常并进行处理。 2. 缩进错误是Python中常见的错误之一(如引用中的缩进错误)。在Python中,缩进是非常重要的,需要保持一致且正确的缩进。可以使用空格或制表符进行缩进,但在同一个代码块中必须使用相同的缩进方式。可以通过检查代码中的缩进是否正确,并使用编辑器的自动缩进功能来修复这类错误。 3. 对于类型错误(如引用中的 TypeError: range() integer end argument expected, got tuple),可以检查代码中的变量类型是否正确。例如,range() 函数的参数应该是整数类型,而不是元组类型。可以通过将变量转换为正确的类型或者重新检查代码逻辑来解决这类错误。 需要注意的是,解决报错需要具体问题具体分析,以上是一些常见的解决方法,但并不适用于所有情况。在实际解决报错时,应该结合具体错误信息和代码逻辑进行分析,并灵活运用适当的方法解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Python报错解决方案(持续更新)](https://blog.csdn.net/qq_23142123/article/details/78877174)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [新手常见的python报错解决方案](https://blog.csdn.net/weixin_30480583/article/details/97686913)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值