无法在 PyCharm venv 中使用 pip 安装 PyNaCl

Cant install PyNaCl with pip inside a PyCharm venv

使用 python3.8.1,在 Windows 10:

安装最新版本

pip install PyNaCl 给我这个错误(最后 10 行):

    File "C:\Program Files (x86)\Python3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Program Files (x86)\Python3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "setup.py", line 161, in run
      raise Exception("ERROR: The 'make' utility is missing from PATH")
  Exception: ERROR: The 'make' utility is missing from PATH

  ----------------------------------------
  Failed building wheel for PyNaCl
  Running setup.py clean for PyNaCl
Failed to build PyNaCl
Could not build wheels for PyNaCl which use PEP 517 and cannot be installed directly

好像跟轮子有关,所以我尝试用no-binary安装,也失败了:

      File "C:\Program Files (x86)\Python3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Administrator\AppData\Local\Temp\pip-install-q0db5s_n\PyNaCl\setup.py", line 161, in run
        raise Exception("ERROR: The 'make' utility is missing from PATH")
    Exception: ERROR: The 'make' utility is missing from PATH

    ----------------------------------------
Command "C:\Users\Administrator\Documents\DiscordBot\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\Administrator\AppData\Local\Temp\pip-install-q0db5s_n\PyNaCl\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Administrator\AppData\Local\Temp\pip-record-s27dvlrv\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Administrator\Documents\DiscordBot\venv\include\site\python3.8\PyNaCl" failed with error code 1 in C:\Users\Administrator\AppData\Local\Temp\pip-install-q0db5s_n\PyNaCl\

编辑:这似乎只是我的 venv 中的一个问题(由 Pycharm 制作)- 我不知道问题是什么,setuptools 和 wheel 都已安装。

我最终用python -m pip install --no-use-pep517 pynacl

解决了

在 venv 中升级 pip 对我有用:

.\env\Scripts\activate
pip install -U pip
pip install -r requirements.txt
deactivate