简体   繁体   中英

Installing numpy with pip on windows machine

I have been trying to install pip for a while now. My python version is python 3.9.11 and my pip version is pip 22.3.1 . I have not been able to install numpy , opencv-python or any other library for that matter. The only one I have ben able to is imutils .

I am getting the below error when I try to install 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).

 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. I see some changes in installation dir.

Use latest Python if that is not a point to be considered. While installing please check the add python to path option

将python添加到路径

This is the cheapest method.

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