简体   繁体   English

在 windows 机器上安装 numpy 和 pip

[英]Installing numpy with pip on windows machine

I have been trying to install pip for a while now.我一直在尝试安装 pip 有一段时间了。 My python version is python 3.9.11 and my pip version is pip 22.3.1 .我的 python 版本是python 3.9.11 ,我的 pip 版本是pip 22.3.1 I have not been able to install numpy , opencv-python or any other library for that matter.我无法安装numpyopencv-python或任何其他与此相关的库。 The only one I have ben able to is imutils .我唯一能够做到的是imutils

I am getting the below error when I try to install wil pip 22.3.1.|当我尝试安装 wil pip 22.3.1 时出现以下错误。|

Collecting numpy
  Using cached numpy-1.23.5.tar.gz (10.7 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [40 lines of output]
      Traceback (most recent call last):
        File "C:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
          main()
        File "C:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 112, in get_requires_for_build_wheel
          backend = _build_backend()
        File "C:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 77, in _build_backend
          obj = import_module(mod_path)
        File "C:\msys64\mingw64\lib\python3.9\importlib\__init__.py", line 127, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
        File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
        File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 850, in exec_module
        File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
        File "C:\Users\user20\AppData\Local\Temp\pip-build-env-mejgr6zx\overlay\lib\python3.9\site-packages\setuptools\__init__.py", line 242, in <module>
          monkey.patch_all()
        File "C:\Users\user20\AppData\Local\Temp\pip-build-env-mejgr6zx\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 99, in patch_all
          patch_for_msvc_specialized_compiler()
        File "C:\Users\user20\AppData\Local\Temp\pip-build-env-mejgr6zx\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 162, in patch_for_msvc_specialized_compiler
          patch_func(*msvc9('find_vcvarsall'))
        File "C:\Users\user20\AppData\Local\Temp\pip-build-env-mejgr6zx\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 149, in patch_params
          mod = import_module(mod_name)
        File "C:\msys64\mingw64\lib\python3.9\importlib\__init__.py", line 127, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
        File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
        File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 850, in exec_module
        File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
        File "C:\Users\user20\AppData\Local\Temp\pip-build-env-mejgr6zx\overlay\lib\python3.9\site-packages\setuptools\_distutils\msvc9compiler.py", line 295, in <module>
          raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
      distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

So I downgraded pip to pip 18.1 but I get this error then(which keeps repeating until failure).所以我将 pip 降级为pip 18.1 ,但随后出现此错误(一直重复直到失败)。

 Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user20\AppData\Local\Temp\pip-build-env-w5yfeple\lib\python3.9\site-packages\setuptools\__init__.py", line 242, in <module>
        monkey.patch_all()
      File "C:\Users\user20\AppData\Local\Temp\pip-build-env-w5yfeple\lib\python3.9\site-packages\setuptools\monkey.py", line 99, in patch_all
        patch_for_msvc_specialized_compiler()
      File "C:\Users\user20\AppData\Local\Temp\pip-build-env-w5yfeple\lib\python3.9\site-packages\setuptools\monkey.py", line 162, in patch_for_msvc_specialized_compiler
        patch_func(*msvc9('find_vcvarsall'))
      File "C:\Users\user20\AppData\Local\Temp\pip-build-env-w5yfeple\lib\python3.9\site-packages\setuptools\monkey.py", line 149, in patch_params
        mod = import_module(mod_name)
      File "C:\msys64\mingw64\lib\python3.9\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "C:\Users\user20\AppData\Local\Temp\pip-build-env-w5yfeple\lib\python3.9\site-packages\setuptools\_distutils\msvc9compiler.py", line 295, in <module>
        raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
    distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\user20\AppData\Local\Temp\pip-install-io7ixug3\numpy\
You are using pip version 18.1, however version 22.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Please let me know if I am doing something wrong.如果我做错了什么,请告诉我。 Thanks in advance提前致谢

Please uninstall your current installation of python and install the latest one on the default path.请卸载您当前安装的 python 并在默认路径上安装最新版本。 I see some changes in installation dir.我看到安装目录发生了一些变化。

Use latest Python if that is not a point to be considered.如果这不是要考虑的点,请使用最新的 Python。 While installing please check the add python to path option安装时请检查添加 python 到路径选项

将python添加到路径

This is the cheapest method.这是成本最低的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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