win10 pip install ujson failed

错误日志

C:\Users\86182>pip install --no-cache-dir ujson
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting ujson
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/86/0a/80d87aa4ee79980bddabef13cb7d95de330f85355cf08dfdaf874889b02b/ujson-4.0.2.tar.gz (7.1 MB)
     |████████████████████████████████| 7.1 MB 10 kB/s
  ERROR: Error expected str, bytes or os.PathLike object, not NoneType while executing command 'c:\users\86182\appdata\local\programs\python\python38-32\python.exe' 'c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\86182\AppData\Local\Temp\pip-build-env-w4la2b14\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host https --trusted-host '' --trusted-host trusted-host -- 'setuptools>=42' wheel 'setuptools_scm[toml]>=3.4'
  Installing build dependencies ... error
ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 171, in _merge_into_criterion
    crit = self.state.criteria[name]
KeyError: 'ujson'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\base_command.py", line 189, in _main
    status = self.run(options, args)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\req_command.py", line 178, in wrapper
    return func(self, options, args)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\commands\install.py", line 316, in run
    requirement_set = resolver.resolve(
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 121, in resolve
    self._result = resolver.resolve(
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 453, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 318, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, in _merge_into_criterion
    crit = Criterion.from_requirement(self._p, requirement, parent)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 82, in from_requirement
    if not cands:
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 124, in __bool__
    return bool(self._sequence)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in __bool__
    return any(self)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 38, in _iter_built
    candidate = func()
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 167, in _make_candidate_from_link
    self._link_candidate_cache[link] = LinkCandidate(
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 300, in __init__
    super().__init__(
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 144, in __init__
    self.dist = self._prepare()
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 226, in _prepare
    dist = self._prepare_distribution()
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 311, in _prepare_distribution
    return self._factory.preparer.prepare_linked_requirement(
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\operations\prepare.py", line 457, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\operations\prepare.py", line 500, in _prepare_linked_requirement
    dist = _get_prepared_distribution(
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\operations\prepare.py", line 66, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\distributions\sdist.py", line 39, in prepare_distribution_metadata
    self._setup_isolation(finder)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\distributions\sdist.py", line 67, in _setup_isolation
    self.req.build_env.install_requirements(
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\build_env.py", line 206, in install_requirements
    call_subprocess(args, spinner=spinner)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\utils\subprocess.py", line 181, in call_subprocess
    proc = subprocess.Popen(
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\subprocess.py", line 1247, in _execute_child
    args = list2cmdline(args)
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\subprocess.py", line 549, in list2cmdline
    for arg in map(os.fsdecode, seq):
  File "c:\users\86182\appdata\local\programs\python\python38-32\lib\os.py", line 816, in fsdecode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType

解决办法指定ujson版本

C:\Users\86182>pip install ujson==1.35
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting ujson==1.35
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/16/c4/79f3409bc710559015464e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz (192 kB)
     |████████████████████████████████| 192 kB 1.1 MB/s
Building wheels for collected packages: ujson
  Building wheel for ujson (setup.py) ... done
  Created wheel for ujson: filename=ujson-1.35-cp38-cp38-win32.whl size=21265 sha256=b7ea0b5d20ac902912f22766fab9e567c218bd82cd331c9dbfe3f90d13eab64f
  Stored in directory: c:\users\86182\appdata\local\pip\cache\wheels\d7\fe\45\c7ba2b668f3acefebfa19efcc5eae5e4593621359dd4f1126e
Successfully built ujson
Installing collected packages: ujson
Successfully installed ujson-1.35

原因:

可能是最新版本有一些问题

参考:

https://github.com/allenai/document-qa/issues/47

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值