首页 > 解决方案 > 尝试 pip install streamlit 时收到错误消息

问题描述

Windows 10。使用最新版本的 pip。蟒蛇 3.8.3。

收到此错误。

我尝试通过 pycharm 安装并得到同样的错误。

    File "numpy\core\setup.py", line 667, in get_mathlib_info
      raise RuntimeError("Broken toolchain: cannot link a simple C program")
  RuntimeError: Broken toolchain: cannot link a simple C program
  ----------------------------------------
ERROR: Command errored out with exit status 1: 
 'C:\Users\thisuser\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, 
setuptools, 
tokenize; sys.argv[0] = '"'"'C:\\Users\\thisuser\\AppData\\Local\\Temp\\pip-install- 
  t1sn8hyk\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\thisuser\\AppData\\Local\\Temp\\pip- 
install-t1sn8hyk\\numpy\\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\thisuser\AppData\Local\Temp\pip-record- 
 zxkfqpfd\install-record.txt' --single-version-externally-managed --prefix 
  'C:\Users\thisuser\AppData\Local\Temp\pip-build-env-t7emgfqy\overlay' --compile --install-headers 
'C:\Users\thisuser\AppData\Local\Temp\pip-build-env-t7emgfqy\overlay\Include\numpy' Check the logs 
 for 
         full command output.
      ----------------------------------------
ERROR: Command errored out with exit status 1: 
  'C:\Users\thisuser\AppData\Local\Programs\Python\Python38-32\python.exe' 
 'C:\Users\thisuser\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip' install -- 
 ignore-installed --no-user --prefix 'C:\Users\thisuser\AppData\Local\Temp\pip-build-env- 
t7emgfqy\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i 
https://pypi.org/simple -- 'cython >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"''  
 numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setuptools_scm wheel Check the logs for 
 full command output

标签: pythonpipstreamlit

解决方案


解决这个问题的最简单的方法,除了试图在 Windows 上为一个包安装 C 编译器之外,是从 Christoph Gohlke 的优秀的Unofficial Windows Binaries for Python Extension Packages站点安装NumPy 的预编译版本。我推荐 MKL(英特尔的数学内核库)版本,但他也有完全开源的“香草”版本。

只需下载.whl与您的操作系统和 Python 版本对应的文件,然后运行

pip install wheel_filename.whl

从您将其下载到的任何目录中,您都将完成设置。如果任何其他pip install命令在尝试编译 Python 包时中断,请先检查 Gohlke 的 repo!


推荐阅读