GVKun编程网logo

Python 3.7.7 安装 Numpy“错误:命令出错,退出状态为 1:”(python中numpy安装报错)

4

在本文中,我们将带你了解Python3.7.7安装Numpy“错误:命令出错,退出状态为1:”在这篇文章中,我们将为您详细介绍Python3.7.7安装Numpy“错误:命令出错,退出状态为1:”的方

在本文中,我们将带你了解Python 3.7.7 安装 Numpy“错误:命令出错,退出状态为 1:”在这篇文章中,我们将为您详细介绍Python 3.7.7 安装 Numpy“错误:命令出错,退出状态为 1:”的方方面面,并解答python中numpy安装报错常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的Anaconda 提示不会下载 sparsesvd - 命令出错,退出状态为 1、Heroku 错误 - 通过 Heroku/Git 插件部署 python 时“命令出错,退出状态为 1”、Heroku:命令出错,退出状态为 128、numpy.random.random & numpy.ndarray.astype & numpy.arange

本文目录一览:

Python 3.7.7 安装 Numpy“错误:命令出错,退出状态为 1:”(python中numpy安装报错)

Python 3.7.7 安装 Numpy“错误:命令出错,退出状态为 1:”(python中numpy安装报错)

如何解决Python 3.7.7 安装 Numpy“错误:命令出错,退出状态为 1:”

我正在尝试在 macOS 上安装 numpy 大苏尔但得到了这个错误。 我也尝试过更新 pip 和 setuptool 更新xcode,但错误仍然出现

ERROR: Command errored out with exit status 1:


 command: /Users/mac/opt/miniconda3/bin/python -u -c ''import sys,setuptools,tokenize; sys.argv[0] = ''"''"''/private/var/folders/24/2bgc31xs4w51ksff8v5kphcc0000gn/T/pip-install-3jq2_h06/numpy_a0d6a6e5f34d4b3b887afd79c04b5c7c/setup.py''"''"''; __file__=''"''"''/private/var/folders/24/2bgc31xs4w51ksff8v5kphcc0000gn/T/pip-install-3jq2_h06/numpy_a0d6a6e5f34d4b3b887afd79c04b5c7c/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 /private/var/folders/24/2bgc31xs4w51ksff8v5kphcc0000gn/T/pip-wheel-hvs0y1qx
       cwd: /private/var/folders/24/2bgc31xs4w51ksff8v5kphcc0000gn/T/pip-install-3jq2_h06/numpy_a0d6a6e5f34d4b3b887afd79c04b5c7c/

...

error: Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/mac/opt/miniconda3/include -arch x86_64 -I/Users/mac/opt/miniconda3/include -arch x86_64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Inumpy/core/include -Ibuild/src.macosx-10.9-x86_64-3.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Users/mac/opt/miniconda3/include/python3.7m -Ibuild/src.macosx-10.9-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.7/numpy/core/src/npymath -Ibuild/src.macosx-10.9-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.7/numpy/core/src/npymath -Ibuild/src.macosx-10.9-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.7/numpy/core/src/npymath -c numpy/random/mtrand/mtrand.c -o build/temp.macosx-10.9-x86_64-3.7/numpy/random/mtrand/mtrand.o -MMD -MF build/temp.macosx-10.9-x86_64-3.7/numpy/random/mtrand/mtrand.o.d" Failed with exit status 1

当pip尝试重新安装numpy时,也会出现这样的错误信息

ERROR: Command errored out with exit status 1: /Users/mac/opt/miniconda3/bin/python -u -c ''import sys,''"''"''exec''"''"''))'' install --record /private/var/folders/24/2bgc31xs4w51ksff8v5kphcc0000gn/T/pip-record-4yafo15v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mac/opt/miniconda3/include/python3.7m/numpy Check the logs for full command output.

有什么想法吗?

解决方法

看起来像 gcc 编译器或某些系统库依赖问题。

这是我的 gcc 版本 (MacOS Catalina)

$ which gcc
/usr/bin/gcc
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

您的 macbook 架构是 x86_64 吗?如果这是新的 ARM64,架构可能是一个原因。

还有 build/temp.macosx-10.9-x86_64-3.7/...build/src.macosx-10.9-x86_64-3.7/... 看起来很旧(OS X 10.9?)。我不熟悉 pip 构建过程,但看起来 python 3.7.X 库不会更新很长时间。较新的 Python 版本是 3.9.X。尝试使用它,这可能是解决方案。

,

根据此链接中的类似问题 (https://github.com/numpy/numpy/issues/12026)。您的安装尝试在您的系统上编译 numpy,这是不必要的。尝试安装 numpy 的具体版本,例如pip3 install numpy==1.19.5

Anaconda 提示不会下载 sparsesvd - 命令出错,退出状态为 1

Anaconda 提示不会下载 sparsesvd - 命令出错,退出状态为 1

在我下载 Visual Studios build tools 后,它对我有用

Heroku 错误 - 通过 Heroku/Git 插件部署 python 时“命令出错,退出状态为 1”

Heroku 错误 - 通过 Heroku/Git 插件部署 python 时“命令出错,退出状态为 1”

如何解决Heroku 错误 - 通过 Heroku/Git 插件部署 python 时“命令出错,退出状态为 1”

当我尝试通过 Heroku/Git 插件部署 python 时,出现此错误:

  1. ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  2. ! Push rejected,Failed to compile Python app.
  3. ! Push Failed

完整日志在这里:https://paste.pythondiscord.com/cexofeluha.sql

有人可以帮我吗?错误是什么意思? 我现在多次遇到此错误。我能做什么? 我正在尝试使用 discord.py 机器人。 我没有更多详细信息,我该怎么办?

解决方法

您的 git+https://github.com/MetalManiac1331/raidbot 中有 requirements.txt,但存储库不是可通过 pip 安装的 Python 包 — 它没有 setup.py。目前它根本没有任何 Python 文件。

requirements.txt 中删除那个损坏的包,提交并再次推送。

Heroku:命令出错,退出状态为 128

Heroku:命令出错,退出状态为 128

如何解决Heroku:命令出错,退出状态为 128

我正在尝试创建一个导入私有存储库的 Heroku 应用程序。我已经设置好了一切,包括:

  • 有效的 BUILDPACK_SSH_KEY
  • Buildpack https://github.com/heroku/heroku-buildpack-ssh-key.git
  • git+ssh://git@github.com/me/private-repo.git 中的需求行(显然改成了实际的仓库路径名)
  • 生成 Heroku 应用所需的所有其他文件(例如 app.py、requirements、procfile、gitignore、用于 opencv 的 Aptfile、用于特定 Python 版本的 runtime.txt 以及用于应用的其他本​​地 .py 文件)。立>

它之前运行得很好,除了该应用程序比最大 slug 大小 (500 MB) 多几 MB 外,它似乎正在导入。现在,我在尝试部署时收到以下消息,但我无法弄清楚如何连接到存储库。

请注意,当我将私有存储库的所需部分复制到推送的文件夹中时,该应用程序可以正常工作,因此它不应该是应用程序本身的错误,而只是私有存储库的连接/安装。

  1. -----> Building on the Heroku-20 stack
  2. -----> Using buildpacks:
  3. 1. heroku-community/apt
  4. 2. https://github.com/heroku/heroku-buildpack-ssh-key.git
  5. 3. heroku/python
  6. -----> Apt app detected
  7. -----> Reusing cache
  8. -----> Updating apt caches
  9. Hit:1 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
  10. Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
  11. Get:3 http://archive.ubuntu.com/ubuntu focal-security InRelease [109 kB]
  12. Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
  13. Fetched 223 kB in 1s (294 kB/s)
  14. Reading package lists...
  15. -----> Fetching .debs for libsm6
  16. Reading package lists...
  17. Building dependency tree...
  18. 0 upgraded,0 newly installed,1 reinstalled,0 to remove and 21 not upgraded.
  19. Need to get 0 B/16.1 kB of archives.
  20. After this operation,0 B of additional disk space will be used.
  21. Download complete and in download only mode
  22. -----> Fetching .debs for libxrender1
  23. Reading package lists...
  24. Building dependency tree...
  25. 0 upgraded,0 to remove and 21 not upgraded.
  26. Need to get 0 B/18.7 kB of archives.
  27. After this operation,0 B of additional disk space will be used.
  28. Download complete and in download only mode
  29. -----> Fetching .debs for libfontconfig1
  30. Reading package lists...
  31. Building dependency tree...
  32. 0 upgraded,0 to remove and 21 not upgraded.
  33. Need to get 0 B/114 kB of archives.
  34. After this operation,0 B of additional disk space will be used.
  35. Download complete and in download only mode
  36. -----> Fetching .debs for libice6
  37. Reading package lists...
  38. Building dependency tree...
  39. 0 upgraded,0 to remove and 21 not upgraded.
  40. Need to get 0 B/41.0 kB of archives.
  41. After this operation,0 B of additional disk space will be used.
  42. Download complete and in download only mode
  43. -----> Fetching .debs for libgl1
  44. Reading package lists...
  45. Building dependency tree...
  46. The following additional packages will be installed:
  47. libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
  48. libdrm2 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0
  49. libllvm11 libpciaccess0 libsensors-config libsensors5 libvulkan1
  50. libwayland-client0 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
  51. libxcb-present0 libxcb-randr0 libxcb-sync1 libxcb-xfixes0 libxdamage1
  52. libxfixes3 libxshmfence1 libxxf86vm1 mesa-vulkan-drivers
  53. Suggested packages:
  54. pciutils lm-sensors
  55. The following NEW packages will be installed:
  56. libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
  57. libdrm2 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0
  58. libllvm11 libpciaccess0 libsensors-config libsensors5 libvulkan1
  59. libwayland-client0 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
  60. libxcb-present0 libxcb-randr0 libxcb-sync1 libxcb-xfixes0 libxdamage1
  61. libxfixes3 libxshmfence1 libxxf86vm1 mesa-vulkan-drivers
  62. 0 upgraded,31 newly installed,0 to remove and 21 not upgraded.
  63. Need to get 0 B/32.2 MB of archives.
  64. After this operation,401 MB of additional disk space will be used.
  65. Download complete and in download only mode
  66. -----> Installing libdrm2_2.4.102-1ubuntu1~20.04.1_amd64.deb
  67. -----> Installing libdrm-amdgpu1_2.4.102-1ubuntu1~20.04.1_amd64.deb
  68. -----> Installing libdrm-common_2.4.102-1ubuntu1~20.04.1_all.deb
  69. -----> Installing libdrm-intel1_2.4.102-1ubuntu1~20.04.1_amd64.deb
  70. -----> Installing libdrm-nouveau2_2.4.102-1ubuntu1~20.04.1_amd64.deb
  71. -----> Installing libdrm-radeon1_2.4.102-1ubuntu1~20.04.1_amd64.deb
  72. -----> Installing libfontconfig1_2.13.1-2ubuntu3_amd64.deb
  73. -----> Installing libgl1_1.3.2-1~ubuntu0.20.04.1_amd64.deb
  74. -----> Installing libgl1-mesa-dri_20.2.6-0ubuntu0.20.04.1_amd64.deb
  75. -----> Installing libglapi-mesa_20.2.6-0ubuntu0.20.04.1_amd64.deb
  76. -----> Installing libglvnd0_1.3.2-1~ubuntu0.20.04.1_amd64.deb
  77. -----> Installing libglx0_1.3.2-1~ubuntu0.20.04.1_amd64.deb
  78. -----> Installing libglx-mesa0_20.2.6-0ubuntu0.20.04.1_amd64.deb
  79. -----> Installing libice6_2%3a1.0.10-0ubuntu1_amd64.deb
  80. -----> Installing libllvm11_1%3a11.0.0-2~ubuntu20.04.1_amd64.deb
  81. -----> Installing libpciaccess0_0.16-0ubuntu1_amd64.deb
  82. -----> Installing libsensors5_1%3a3.6.0-2ubuntu1_amd64.deb
  83. -----> Installing libsensors-config_1%3a3.6.0-2ubuntu1_all.deb
  84. -----> Installing libsm6_2%3a1.2.3-1_amd64.deb
  85. -----> Installing libvulkan1_1.2.131.2-1_amd64.deb
  86. -----> Installing libwayland-client0_1.18.0-1_amd64.deb
  87. -----> Installing libx11-xcb1_2%3a1.6.9-2ubuntu1.1_amd64.deb
  88. -----> Installing libxcb-dri2-0_1.14-2_amd64.deb
  89. -----> Installing libxcb-dri3-0_1.14-2_amd64.deb
  90. -----> Installing libxcb-glx0_1.14-2_amd64.deb
  91. -----> Installing libxcb-present0_1.14-2_amd64.deb
  92. -----> Installing libxcb-randr0_1.14-2_amd64.deb
  93. -----> Installing libxcb-sync1_1.14-2_amd64.deb
  94. -----> Installing libxcb-xfixes0_1.14-2_amd64.deb
  95. -----> Installing libxdamage1_1%3a1.1.5-2_amd64.deb
  96. -----> Installing libxfixes3_1%3a5.0.3-2_amd64.deb
  97. -----> Installing libxrender1_1%3a0.9.10-1_amd64.deb
  98. -----> Installing libxshmfence1_1.3-1_amd64.deb
  99. -----> Installing libxxf86vm1_1%3a1.1.4-1build1_amd64.deb
  100. -----> Installing mesa-vulkan-drivers_20.2.6-0ubuntu0.20.04.1_amd64.deb
  101. -----> Writing profile script
  102. -----> Rewrite package-config files
  103. -----> heroku-buildpack-ssh-key app detected
  104. -----> Install heroku-buildpack-ssh-key
  105. -----> Installed SSH key from BUILDPACK_SSH_KEY
  106. -----> Python app detected
  107. ! Python has released a security update! Please consider upgrading to python-3.7.10
  108. Learn More: https://devcenter.heroku.com/articles/python-runtimes
  109. -----> Requirements file has been changed,clearing cached dependencies
  110. -----> Installing python-3.7.9
  111. -----> Installing pip 20.2.4,setuptools 47.1.1 and wheel 0.36.2
  112. -----> Installing sqlite3
  113. -----> Installing requirements with pip
  114. Collecting git+ssh://****@github.com/me/private-repo.git (from -r /tmp/build_ede3698e/requirements.txt (line 33))
  115. cloning ssh://****@github.com/me/private-repo.git to /tmp/pip-req-build-xrwjgy49
  116. ERROR: Command errored out with exit status 128: git clone -q ''ssh://****@github.com/me/private-repo.git'' /tmp/pip-req-build-xrwjgy49 Check the logs for full command output.
  117. ! Push rejected,Failed to compile Python app.
  118. ! Push Failed

解决方法

结果我只是打错了仓库的名称。

numpy.random.random & numpy.ndarray.astype & numpy.arange

numpy.random.random & numpy.ndarray.astype & numpy.arange

今天看到这样一句代码:

xb = np.random.random((nb, d)).astype(''float32'') #创建一个二维随机数矩阵(nb行d列)
xb[:, 0] += np.arange(nb) / 1000. #将矩阵第一列的每个数加上一个值

要理解这两句代码需要理解三个函数

1、生成随机数

numpy.random.random(size=None) 

size为None时,返回float。

size不为None时,返回numpy.ndarray。例如numpy.random.random((1,2)),返回1行2列的numpy数组

 

2、对numpy数组中每一个元素进行类型转换

numpy.ndarray.astype(dtype)

返回numpy.ndarray。例如 numpy.array([1, 2, 2.5]).astype(int),返回numpy数组 [1, 2, 2]

 

3、获取等差数列

numpy.arange([start,]stop,[step,]dtype=None)

功能类似python中自带的range()和numpy中的numpy.linspace

返回numpy数组。例如numpy.arange(3),返回numpy数组[0, 1, 2]

今天关于Python 3.7.7 安装 Numpy“错误:命令出错,退出状态为 1:”python中numpy安装报错的介绍到此结束,谢谢您的阅读,有关Anaconda 提示不会下载 sparsesvd - 命令出错,退出状态为 1、Heroku 错误 - 通过 Heroku/Git 插件部署 python 时“命令出错,退出状态为 1”、Heroku:命令出错,退出状态为 128、numpy.random.random & numpy.ndarray.astype & numpy.arange等更多相关知识的信息可以在本站进行查询。

本文标签: