TypeError: expected str, bytes or os.PathLike object, not int

使用pip install安装软件的时候遇到如下错误:

Exception:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/usr/lib/python3/dist-packages/pip/commands/install.py”, line 290, in run
with self._build_session(options) as session:
File “/usr/lib/python3/dist-packages/pip/basecommand.py”, line 69, in _build_session
if options.cache_dir else None
File “/usr/lib/python3.7/posixpath.py”, line 80, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not int

解决办法: (可以把python替换为python3)

curl https://bootstrap.pypa.io/get-pip.py | python -

猜测错误原因是:setuptools和pip的版本不对应,所以升级一下pip就可以了。

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
TypeError: expected str, bytes or os.PathLike object, not tuple 这个错误通常发生在使用savemat函数并传入一个元组作为参数时。savemat函数是用于将数据保存到MATLAB格式文件的函数。根据引用中的解决方案,我们可以使用numpy库的asarray函数将元组转换为数组,然后再将数组传递给savemat函数来解决这个问题。 下面是解决savemat TypeError的步骤: 1. 导入numpy库:import numpy as np 2. 将元组转换为数组:data_array = np.asarray(your_tuple) 3. 使用savemat函数保存数据:scipy.io.savemat(file_name, {'data': data_array}) 通过以上步骤,你就可以成功解决savemat TypeError: expected str, bytes or os.PathLike object, not tuple的问题。请确保你已经安装了numpy和scipy库,并将你的元组数据正确传递给savemat函数。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [pip安装pyautogui时报错:TypeError: expected str, bytes or os.PathLike object, not NoneType](https://blog.csdn.net/zhouqiesheng/article/details/131796214)[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%"] - *3* [解决Python中报错TypeError: must be str, not bytes问题](https://download.csdn.net/download/weixin_38609765/12853546)[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 ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值