无法安装pyhash模块

2024-06-25 06:08:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试安装pyhash模块,因为我一直收到一个错误。我尝试了'pip install pyhash'和'pip install pyhash==0.9.3',但都没有成功。错误是:

ERROR: Command errored out with exit status 1:
 command: 'c:\users\perei\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-install-wv99g0bl\\pyhash\\setup.py'"'"'; __file__='"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-install-wv99g0bl\\pyhash\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\perei\AppData\Local\Temp\pip-pip-egg-info-sjbip8mh'
     cwd: C:\Users\perei\AppData\Local\Temp\pip-install-wv99g0bl\pyhash\
Complete output (7 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\perei\AppData\Local\Temp\pip-install-wv99g0bl\pyhash\setup.py", line 38, in <module>
    os.path.join(os.environ.get('PYTHON_HOME'), 'include'),
  File "c:\users\perei\appdata\local\programs\python\python38-32\lib\ntpath.py", line 78, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
----------------------------------------
 ERROR: Command errored out with exit status 1: python setup.py egg_info 
 Check the logs for full command output.

新错误消息(已替换旧错误消息):

ERROR: Command errored out with exit status 1:
 command: 'c:\users\perei\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-install-di3e7yi2\\pyhash\\setup.py'"'"'; __file__='"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-install-di3e7yi2\\pyhash\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\perei\AppData\Local\Temp\pip-pip-egg-info-wazs_edo'
     cwd: C:\Users\perei\AppData\Local\Temp\pip-install-di3e7yi2\pyhash\
Complete output (47 lines):
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\perei\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-wheel-twqluha8\\py-cpuinfo\\setup.py'"'"'; __file__='"'"'C:\\Users\\perei\\AppData\\Local\\Temp\\pip-wheel-twqluha8\\py-cpuinfo\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\perei\AppData\Local\Temp\pip-wheel-km81z24z'
       cwd: C:\Users\perei\AppData\Local\Temp\pip-wheel-twqluha8\py-cpuinfo\
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help

  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for py-cpuinfo
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
  File "c:\users\perei\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\installer.py", line 126, in fetch_build_egg
    subprocess.check_call(cmd)
  File "c:\users\perei\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\\users\\perei\\appdata\\local\\programs\\python\\python38-32\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\perei\\AppData\\Local\\Temp\\tmpkg2kgy4i', '--quiet', 'py-cpuinfo']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Tags: installpippyegglocalsetupusersappdata
2条回答

您需要安装pypy(python的不同实现)

pyhash仅支持pypy v6.0或更新版本,请下载并安装最新的pypy

https://www.pypy.org/download.html

第一条错误消息

输出显示安装失败,因为安装脚本希望设置PYTHON_HOME环境变量,但实际情况并非如此

在重新运行pip install命令(在同一个shell中)之前,请尝试在shell中执行此命令:
set PYTHON_HOME=c:\users\perei\appdata\local\programs\python\python38-32

备选方案:永久设置PYTHON_HOME

  1. 打开“开始”菜单并开始键入“env”…,然后单击“编辑系统环境变量(控制面板)”
  2. 单击“用户变量”下的New...
  3. Variable name下放置“PYTHON_HOME”
  4. Variable value下放置Python安装目录的路径,例如“c:\users\perei\appdata\local\programs\Python\python38-32”
  5. 打开一个新的cmd.exe实例,然后重试pip install命令

第二条错误消息

脚本在尝试构建控制盘时失败:error: invalid command 'bdist_wheel'。在失败之前,它实际上会警告The wheel package is not available.。你只需要做pip install wheel

相关问题 更多 >