Skip to main content
 首页 » 编程设计

python之安装了 versioneer,但 pip install 仍然给出 ModuleNotFoundError

2024年11月24日7lhb25

我在我的环境中安装了 versioneer 模块,通过运行 python -m versioneer --version 确认。然而,当我 pip install cartopy 时,我仍然得到一个 ModuleNotFoundError,如下所示:

(GIS3) gholl@lce00:~> python -m versioneer --version 
versioneer (installer) 0.18 
(GIS3) gholl@lce00:~> python -V 
Python 3.7.1 
(GIS3) gholl@lce00:~> which python 
/hpc/uhome/gholl/miniconda3/envs/GIS3/bin/python 
(GIS3) gholl@lce00:~> which pip 
/hpc/uhome/gholl/miniconda3/envs/GIS3/bin/pip 
(GIS3) gholl@lce00:~> pip install cartopy 
Collecting cartopy 
  Using cached https://files.pythonhosted.org/packages/e5/92/fe8838fa8158931906dfc4f16c5c1436b3dd2daf83592645b179581403ad/Cartopy-0.17.0.tar.gz 
  Installing build dependencies ... done 
  Getting requirements to build wheel ... error 
  Complete output from command /hpc/uhome/gholl/miniconda3/envs/GIS3/bin/python /hpc/uhome/gholl/miniconda3/envs/GIS3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /hpc/gtmp/gholl/.jtmp.lce00.20190206.082115.24214/tmpmcze3ux9: 
  Traceback (most recent call last): 
    File "/hpc/uhome/gholl/miniconda3/envs/GIS3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module> 
      main() 
    File "/hpc/uhome/gholl/miniconda3/envs/GIS3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main 
      json_out['return_val'] = hook(**hook_input['kwargs']) 
    File "/hpc/uhome/gholl/miniconda3/envs/GIS3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel 
      return hook(config_settings) 
    File "/lustre1/gtmp/gholl/.jtmp.lce00.20190206.082115.24214/pip-build-env-q2k4jnrs/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 130, in get_requires_for_build_wheel 
      return self._get_build_requires(config_settings, requirements=['wheel']) 
    File "/lustre1/gtmp/gholl/.jtmp.lce00.20190206.082115.24214/pip-build-env-q2k4jnrs/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 112, in _get_build_requires 
      self.run_setup() 
    File "/lustre1/gtmp/gholl/.jtmp.lce00.20190206.082115.24214/pip-build-env-q2k4jnrs/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 126, in run_setup 
      exec(compile(code, __file__, 'exec'), locals()) 
    File "setup.py", line 36, in <module> 
      import versioneer 
  ModuleNotFoundError: No module named 'versioneer' 
 
  ---------------------------------------- 
Command "/hpc/uhome/gholl/miniconda3/envs/GIS3/bin/python /hpc/uhome/gholl/miniconda3/envs/GIS3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /hpc/gtmp/gholl/.jtmp.lce00.20190206.082115.24214/tmpmcze3ux9" failed with error code 1 in /lustre1/gtmp/gholl/.jtmp.lce00.20190206.082115.24214/pip-install-2q1hjb0u/cartopy 

为什么安装了versioneer模块,但是pip install cartopy还是找不到?


(我知道我 should probably not pip 安装到 conda 环境中,但我同时调试一个完整的 conda install 想要降级 Python 的问题,或导致 undefined symbolcannot open shared object file 错误,所以这个问题确实有一个 XY problem 的方面——但是,我还有其他的东西要尝试我的 Y)

请您参考如下方法:

Cartopy 0.17.0 存在一个已知问题,引用此处:Unable to install cartopy from pip on MacOSX #1270

您可以尝试使用 pip install cartopy==0.16.0,或者尝试使用 pip install --no-use-pep517 cartopy。或者,这似乎是 >= 0.19 的问题,因此您也可以尝试降级 pip。