我在使用pyenv时发现安装包失败。
我不知道确切的原因,但在安装新包时找不到已安装的模块。
例如,当我使用
pyenv activate xxx
激活虚拟环境并尝试使用 pip install vamp
安装 vamp 包时,即使我安装了 numpy,也会出现以下错误。 (请注意,我使用的是 python 3.8.19 的虚拟环境)
Collecting vamp
Using cached vamp-1.1.0.tar.gz (107 kB)
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
╰─> [17 lines of output]
Traceback (most recent call last):
File "/home/USER_NAME/.pyenv/versions/3.8.19/envs/ENV_NAME/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/USER_NAME/.pyenv/versions/3.8.19/envs/ENV_NAME/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/USER_NAME/.pyenv/versions/3.8.19/envs/ENV_NAME/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-12igiyji/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/tmp/pip-build-env-12igiyji/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-12igiyji/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 487, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-12igiyji/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "<string>", line 3, in <module>
ModuleNotFoundError: No module named 'numpy'
[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.
当我使用
pyenv shell 3.8.19
代替pyenv activate xxx
时也会出现同样的现象
其他软件包(例如omnisart、madmom 和natten)也会出现这种错误。
我认为你需要降级你的python版本或者升级包版本^^