很抱歉,我的英语说得不好,因为我的英语不好。
具体来说,环境是根据this article构建的。
执行“ pipenv install gunicorn”命令引入“ gunicorn”时发生错误。
“ pipenv install gunicorn”的执行结果如下。
/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/attr/_make.py:618: RuntimeWarning: Missing ctypes. Some features like bare super() or accessing __class__ will not work with slots classes.
set_closure_cell(cell, cls)
Installing gunicorn…
Traceback (most recent call last):
File "/home/app-user/.local/python/bin/pipenv", line 10, in <module>
sys.exit(cli())
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/cli/command.py", line 254, in install
editable_packages=state.installstate.editables,
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/core.py", line 1909, in do_install
pkg_requirement = Requirement.from_line(pkg_line)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1068, in from_line
if isinstance(line, pip_shims.shims.InstallRequirement):
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/pip_shims/shims.py", line 254, in __getattr__
return super(_shims, self).__getattribute__(*args, **kwargs)
AttributeError: '_shims' object has no attribute 'InstallRequirement'
感谢您为解决上述错误所提供的帮助。
谢谢。
答案 0 :(得分:0)
如果您将Pyenv用于python版本管理,则可以执行以下步骤:
确保已正确设置pyenv并在bashrc,bash_profile或zshrc中包含以下行;取决于您的操作系统和外壳。有关更多信息,请检查documentation
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
使用pyenv unistall X.X.X
删除旧的python安装,其中X.X.X
是python的版本号。
使用pyenv install X.X.X