简体   繁体   中英

How to fix “ERROR: Command errored out with exit status 1” when using pip to install numpy in Python 3.8.0

After upgrading Python to 3.8.0, I have trouble installing packages related to numpy using pip, including numpy, matplotlib and sklearn. The error message is as follows:

What should I do to solve this problem?

C:\WINDOWS\System32>pip install numpy

...

Installing collected packages: numpy
    Running setup.py install for numpy ... error
    ERROR: Command errored out with exit status 1:                                                                           command: 'c:\users\tonakai\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\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\Tonakai\AppData\Local\Temp\pip-record-3pg_3uvq\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Tonakai\AppData\Local\Temp\pip-install-ub45_c1a\numpy\
    Complete output (299 lines):
    Running from numpy source directory.

    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:

      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)

  blas_mkl_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries mkl_rt not found in ['c:\\users\\tonakai\\appdata\\local\\programs\\python\\python38\\lib', 'C:\\', 'c:\\users\\tonakai\\appdata\\local\\programs\\python\\python38\\libs']
    NOT AVAILABLE
...

c:\users\tonakai\appdata\local\programs\python\python38\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    non-existing path in 'numpy\\random': 'src\\splitmix64\\splitmix.h'
    running install
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    running build_src
    build_src
    building py_modules sources
    building library "npymath" sources
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\tonakai\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\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\Tonakai\AppData\Local\Temp\pip-record-3pg_3uvq\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

You need to upgrade setuptools and pip. You can do that by running:

pip install -U pip setuptools

Then you can run your pip install numpy .

I am having the same issue after upgrading to Python 3.8, perhaps these packages are not compatible with 3.8?

I have the same situation with python 3.8 when i'm installing cx_Oracle

c:\Users\paulo.mota\Desktop\RoboBlob>pip install cx_Oracle Collecting cx_Oracle Using cached https://files.pythonhosted.org/packages/d0/00/2d4b1e27da6dda2408dcfe4e192b26c2e190be573c6aadb0c97739f15774/cx_Oracle-7.2.3.tar.gz Building wheels for collected packages: cx-Oracle Building wheel for cx-Oracle (setup.py)... error ERROR: Command errored out with exit status 1: command: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\setup.py'"'"'; file ='"'"'C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\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\paulo.mota\AppData\Local\Temp\pip-wheel-avcyfia8' --python-tag cp38 cwd: C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\ Complete output (51 lines): running bdist_wheel running build running build_ext building 'cx_Oracle' extension Traceback (most recent call last): File "", line 1, in File "C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\setup.py", line 110, in setup( File "c:\program files (x86)\python38-32\lib\site-packages\setuptools__init__.py", line 145, in setup return distutils.core.setup(**attrs) File "c:\program files (x86)\python38-32\lib\distutils\core.py", line 148, in setup dist.run_commands() Fil e "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "c:\program files (x86)\python38-32\lib\site-packages\wheel\bdist_wheel.py", line 192, in run self.run_command('build') File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "c:\program files (x86)\python38-32\lib\distutils\command\build.py", line 135, in run self.run_command(cmd_name) File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\command\b uild_ext.py", line 84, in run _build_ext.run(self) File "c:\program files (x86)\python38-32\lib\distutils\command\build_ext.py", line 340, in run self.build_extensions() File "c:\program files (x86)\python38-32\lib\distutils\command\build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "c:\program files (x86)\python38-32\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\command\build_ext.py", line 205, in build_extension _build_ext.build_extension(self, ext) File "c:\program files (x86)\python38-32\lib\distutils\command\build_ext.py", line 528, in build_extension objects = self.compiler.compile(sources, File "c:\program files (x86)\python38-32\lib\distutils_msvccompiler.py", line 360, in compile self.initialize() File "c:\program files (x86)\python38-32\lib\distutils_msvccompiler.py", line 253, in initialize vc_env = _get_vc_env(plat_spec) File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\msvc.py", line 170, in msvc14_get_vc_env return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env() File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\msvc.py", line 1619, in return_env if self.vs_ver >= 14 and isfile(self.VCRuntimeRedist): File "c:\program files (x86)\python38-32\lib\genericpath.py", line 30, in isfile st = os.stat(path) TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType


ERROR: Failed building wheel for cx-Oracle Running setup.py clean for cx-Oracle Failed to build cx-Oracle Installing collected packages: cx-Oracle Running setup.py install for cx-Oracle... error ERROR: Command errored out with exit status 1: command: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\setup.py'"'"'; file ='"'"'C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\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\paulo.mota\AppData\Local\Temp\pip-record-is61e710\install-record.txt' --single-version-externally-managed --compile cwd: C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\ Complete output (53 lines): running install running build running build_ext building 'cx_Oracle' extension Traceback (most recent call last): File "", line 1, in File "C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\setup.py", line 110, in setup( File "c:\program files (x86)\python38-32\lib\site-packages\setuptools__init__.py", line 145, in setup return distutils.core.setup(**attrs) File "c:\program files (x86)\python38-32\lib\distutils\core.p y", line 148, in setup dist.run_commands() File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\command\install.py", line 61, in run return orig.install.run(self) File "c:\program files (x86)\python38-32\lib\distutils\command\install.py", line 545, in run self.run_command('build') File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "c:\program files (x86)\python38-32\lib\distutils\command\build.py", line 135, in run self.run_command(cmd_name) File "c:\program files (x86)\python38-32\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File " c:\program files (x86)\python38-32\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\command\build_ext.py", line 84, in run _build_ext.run(self) File "c:\program files (x86)\python38-32\lib\distutils\command\build_ext.py", line 340, in run self.build_extensions() File "c:\program files (x86)\python38-32\lib\distutils\command\build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "c:\program files (x86)\python38-32\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\command\build_ext.py", line 205, in build_extension _build_ext.build_extension(self, ext) File "c:\program files (x86)\python38-32\lib\distutils\command\build_ext.py", line 528, in build_extension objects = self.compiler.compile(sources, File "c:\program files (x86)\python38-32\lib\distutils_msvccomp iler.py", line 360, in compile self.initialize() File "c:\program files (x86)\python38-32\lib\distutils_msvccompiler.py", line 253, in initialize vc_env = _get_vc_env(plat_spec) File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\msvc.py", line 170, in msvc14_get_vc_env return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env() File "c:\program files (x86)\python38-32\lib\site-packages\setuptools\msvc.py", line 1619, in return_env if self.vs_ver >= 14 and isfile(self.VCRuntimeRedist): File "c:\program files (x86)\python38-32\lib\genericpath.py", line 30, in isfile st = os.stat(path) TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\setup.py'"'"'; file ='"'"'C:\Users\paulo.mota\AppData\Local\Temp\pip-install-38ong8sd\cx-Oracle\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\paulo.mota\AppData\Local\Temp\pip-record-is61e710\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM