在本文中,我们将带你了解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安装报错)
- 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:”
我正在尝试在 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
在我下载 Visual Studios build tools 后,它对我有用
Heroku 错误 - 通过 Heroku/Git 插件部署 python 时“命令出错,退出状态为 1”
如何解决Heroku 错误 - 通过 Heroku/Git 插件部署 python 时“命令出错,退出状态为 1”
当我尝试通过 Heroku/Git 插件部署 python 时,出现此错误:
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
! Push rejected,Failed to compile Python app.
! 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 应用程序。我已经设置好了一切,包括:
- 有效的 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 外,它似乎正在导入。现在,我在尝试部署时收到以下消息,但我无法弄清楚如何连接到存储库。
请注意,当我将私有存储库的所需部分复制到推送的文件夹中时,该应用程序可以正常工作,因此它不应该是应用程序本身的错误,而只是私有存储库的连接/安装。
-----> Building on the Heroku-20 stack
-----> Using buildpacks:
1. heroku-community/apt
2. https://github.com/heroku/heroku-buildpack-ssh-key.git
3. heroku/python
-----> Apt app detected
-----> Reusing cache
-----> Updating apt caches
Hit:1 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Fetched 223 kB in 1s (294 kB/s)
Reading package lists...
-----> Fetching .debs for libsm6
Reading package lists...
Building dependency tree...
0 upgraded,0 newly installed,1 reinstalled,0 to remove and 21 not upgraded.
Need to get 0 B/16.1 kB of archives.
After this operation,0 B of additional disk space will be used.
Download complete and in download only mode
-----> Fetching .debs for libxrender1
Reading package lists...
Building dependency tree...
0 upgraded,0 to remove and 21 not upgraded.
Need to get 0 B/18.7 kB of archives.
After this operation,0 B of additional disk space will be used.
Download complete and in download only mode
-----> Fetching .debs for libfontconfig1
Reading package lists...
Building dependency tree...
0 upgraded,0 to remove and 21 not upgraded.
Need to get 0 B/114 kB of archives.
After this operation,0 B of additional disk space will be used.
Download complete and in download only mode
-----> Fetching .debs for libice6
Reading package lists...
Building dependency tree...
0 upgraded,0 to remove and 21 not upgraded.
Need to get 0 B/41.0 kB of archives.
After this operation,0 B of additional disk space will be used.
Download complete and in download only mode
-----> Fetching .debs for libgl1
Reading package lists...
Building dependency tree...
The following additional packages will be installed:
libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
libdrm2 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0
libllvm11 libpciaccess0 libsensors-config libsensors5 libvulkan1
libwayland-client0 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-present0 libxcb-randr0 libxcb-sync1 libxcb-xfixes0 libxdamage1
libxfixes3 libxshmfence1 libxxf86vm1 mesa-vulkan-drivers
Suggested packages:
pciutils lm-sensors
The following NEW packages will be installed:
libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
libdrm2 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0
libllvm11 libpciaccess0 libsensors-config libsensors5 libvulkan1
libwayland-client0 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-present0 libxcb-randr0 libxcb-sync1 libxcb-xfixes0 libxdamage1
libxfixes3 libxshmfence1 libxxf86vm1 mesa-vulkan-drivers
0 upgraded,31 newly installed,0 to remove and 21 not upgraded.
Need to get 0 B/32.2 MB of archives.
After this operation,401 MB of additional disk space will be used.
Download complete and in download only mode
-----> Installing libdrm2_2.4.102-1ubuntu1~20.04.1_amd64.deb
-----> Installing libdrm-amdgpu1_2.4.102-1ubuntu1~20.04.1_amd64.deb
-----> Installing libdrm-common_2.4.102-1ubuntu1~20.04.1_all.deb
-----> Installing libdrm-intel1_2.4.102-1ubuntu1~20.04.1_amd64.deb
-----> Installing libdrm-nouveau2_2.4.102-1ubuntu1~20.04.1_amd64.deb
-----> Installing libdrm-radeon1_2.4.102-1ubuntu1~20.04.1_amd64.deb
-----> Installing libfontconfig1_2.13.1-2ubuntu3_amd64.deb
-----> Installing libgl1_1.3.2-1~ubuntu0.20.04.1_amd64.deb
-----> Installing libgl1-mesa-dri_20.2.6-0ubuntu0.20.04.1_amd64.deb
-----> Installing libglapi-mesa_20.2.6-0ubuntu0.20.04.1_amd64.deb
-----> Installing libglvnd0_1.3.2-1~ubuntu0.20.04.1_amd64.deb
-----> Installing libglx0_1.3.2-1~ubuntu0.20.04.1_amd64.deb
-----> Installing libglx-mesa0_20.2.6-0ubuntu0.20.04.1_amd64.deb
-----> Installing libice6_2%3a1.0.10-0ubuntu1_amd64.deb
-----> Installing libllvm11_1%3a11.0.0-2~ubuntu20.04.1_amd64.deb
-----> Installing libpciaccess0_0.16-0ubuntu1_amd64.deb
-----> Installing libsensors5_1%3a3.6.0-2ubuntu1_amd64.deb
-----> Installing libsensors-config_1%3a3.6.0-2ubuntu1_all.deb
-----> Installing libsm6_2%3a1.2.3-1_amd64.deb
-----> Installing libvulkan1_1.2.131.2-1_amd64.deb
-----> Installing libwayland-client0_1.18.0-1_amd64.deb
-----> Installing libx11-xcb1_2%3a1.6.9-2ubuntu1.1_amd64.deb
-----> Installing libxcb-dri2-0_1.14-2_amd64.deb
-----> Installing libxcb-dri3-0_1.14-2_amd64.deb
-----> Installing libxcb-glx0_1.14-2_amd64.deb
-----> Installing libxcb-present0_1.14-2_amd64.deb
-----> Installing libxcb-randr0_1.14-2_amd64.deb
-----> Installing libxcb-sync1_1.14-2_amd64.deb
-----> Installing libxcb-xfixes0_1.14-2_amd64.deb
-----> Installing libxdamage1_1%3a1.1.5-2_amd64.deb
-----> Installing libxfixes3_1%3a5.0.3-2_amd64.deb
-----> Installing libxrender1_1%3a0.9.10-1_amd64.deb
-----> Installing libxshmfence1_1.3-1_amd64.deb
-----> Installing libxxf86vm1_1%3a1.1.4-1build1_amd64.deb
-----> Installing mesa-vulkan-drivers_20.2.6-0ubuntu0.20.04.1_amd64.deb
-----> Writing profile script
-----> Rewrite package-config files
-----> heroku-buildpack-ssh-key app detected
-----> Install heroku-buildpack-ssh-key
-----> Installed SSH key from BUILDPACK_SSH_KEY
-----> Python app detected
! Python has released a security update! Please consider upgrading to python-3.7.10
Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> Requirements file has been changed,clearing cached dependencies
-----> Installing python-3.7.9
-----> Installing pip 20.2.4,setuptools 47.1.1 and wheel 0.36.2
-----> Installing sqlite3
-----> Installing requirements with pip
Collecting git+ssh://****@github.com/me/private-repo.git (from -r /tmp/build_ede3698e/requirements.txt (line 33))
cloning ssh://****@github.com/me/private-repo.git to /tmp/pip-req-build-xrwjgy49
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.
! Push rejected,Failed to compile Python app.
! Push Failed
解决方法
结果我只是打错了仓库的名称。
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等更多相关知识的信息可以在本站进行查询。
本文标签: