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

Exception:
Traceback (most recent call last):
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/commands/list.py”, line 157, in run
packages = self.get_outdated(packages, options)
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/commands/list.py”, line 168, in get_outdated
dist for dist in self.iter_packages_latest_infos(packages, options)
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/commands/list.py”, line 168, in
dist for dist in self.iter_packages_latest_infos(packages, options)
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/commands/list.py”, line 197, in iter_packages_latest_infos
with self._build_session(options) as session:
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/basecommand.py”, line 69, in _build_session
if options.cache_dir else None
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/posixpath.py”, line 78, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not int
Traceback (most recent call last):
File “/home/yu/anaconda3/envs/TRTC/bin/pip”, line 6, in
sys.exit(pip.main())
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/init.py”, line 249, in main
return command.main(cmd_args)
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/basecommand.py”, line 251, in main
timeout=min(5, options.timeout)) as session:
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/site-packages/pip/basecommand.py”, line 69, in _build_session
if options.cache_dir else None
File “/home/yu/anaconda3/envs/TRTC/lib/python3.6/posixpath.py”, line 78, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not int

Solution: (you can replace python with python3)
curl https://bootstrap.pypa.io/get-pip.py | python –
Guess the reason for the error is: setuptools and pip versions do not correspond, so upgrade the pip will be fine.

Read More: