TypeError: expected str, bytes or os.PathLike object, not int(解决方法)
Posted ZONG_XP
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TypeError: expected str, bytes or os.PathLike object, not int(解决方法)相关的知识,希望对你有一定的参考价值。
在使用 pip 安装软件时,报错如下
$ pip install numpy
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.6/posixpath.py", line 80, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not int
解决方法是升级一下 pip 版本,并重新安装即可
$ curl https://bootstrap.pypa.io/get-pip.py | python -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1892k 100 1892k 0 0 1958k 0 --:--:-- --:--:-- --:--:-- 1956k
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/, https://pypi.ngc.nvidia.com
Collecting pip
Downloading http://mirrors.aliyun.com/pypi/packages/cd/82/04e9aaf603fdbaecb4323b9e723f13c92c245f6ab2902195c53987848c78/pip-21.1.2-py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 407 kB/s
Installing collected packages: pip
Successfully installed pip-21.1.2
以上是关于TypeError: expected str, bytes or os.PathLike object, not int(解决方法)的主要内容,如果未能解决你的问题,请参考以下文章
TypeError: expected str, bytes or os.PathLike object, not module
sqlalchemy ORM 调用失败并出现 TypeError: expected bytes, str found
Python2.7 在使用BSTestRunner.py时报错TypeError: unicode argument expected, got 'str'
python报错:TypeError: sequence item 0: expected str instance, int found
TypeError: expected str, bytes or os.PathLike object, not int(解决方法)
Python 在用 Pyinstaller封装exe-TypeError: expected str, bytes or os.PathLike object, not NoneType 解决方法!