在windows pycharm上使用pip安装cartopy时遇到以下错误

46scxncf  于 2022-11-08  发布在  PyCharm
关注(0)|答案(1)|浏览(327)
> pip install --user cartopy
Collecting cartopy
  Using cached Cartopy-0.20.3.tar.gz (10.8 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
  ╰─> [45 lines of output]
      Traceback (most recent call last):
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\numpy\core\__init__.py", line 16, in <module>
          from . import multiarray
      ImportError: DLL load failed: The specified module could not be found.

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 58, in <module>
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\numpy\__init__.py", line 142, in <module>
          from . import add_newdocs
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
          from numpy.lib import add_newdoc
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
          from .type_check import *
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
          import numpy.core.numeric as _nx
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\numpy\core\__init__.py", line 26, in <module>
          raise ImportError(msg)
      ImportError:
      Importing the multiarray numpy extension module failed.  Most
      likely you are trying to import a failed build of numpy.
      If you're working with a numpy git repo, try `git clean -xdf` (removes all
      files not under version control).  Otherwise reinstall numpy.

      Original error was: DLL load failed: The specified module could not be found.

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\vijtiwar\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module> 
          main()
        File "C:\Users\vijtiwar\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main     
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\vijtiwar\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requi
res_for_build_wheel
          return hook(config_settings)
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "C:\Users\vijtiwar\AppData\Local\Temp\pip-build-env-aheh7c1s\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 60, in <module>
      ImportError: NumPy 1.10+ is required to install cartopy.
      [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.
fae0ux8s

fae0ux8s1#

根本原因可能是numpy版本不兼容或numpy安装中断。从错误消息中可以看出:
ImportError: NumPy 1.10+ is required to install cartopy.
在这个环境中,你把numpy的版本定得太低了。我不知道是什么原因让你坚持使用这个版本的numpy,但是你应该可以通过使用virtualenv创建一个新的环境,激活它,安装numpy〉1.18(按照cartopy requirements),然后安装cartopy。

相关问题