ModuleNotFoundError:没有名为“gitlab”的模块

hug*_*ugo 5 python gitlab

出于某种原因,我ModuleNotFoundError: No module named 'gitlab'在安装 python-gitlab 后遇到了这个错误。我是通过...安装的

  • 以 venv 开始 source venv/bin/activate
  • sudo pip install --upgrade python-gitlab (根据 python-gitlab 文档)
  • 也尝试过pip install python-gitlab(在之前的 pip 卸载之后)
  • 紧接着一个 pip freeze > requirements.txt
  • 然后import gitlab在我的页面顶部

安装后的输出是...

Collecting python-gitlab
Requirement not upgraded as not directly required: six in ./venv/lib/python3.6/site-packages (from python-gitlab) (1.11.0)
Requirement not upgraded as not directly required: requests>=2.4.2 in ./venv/lib/python3.6/site-packages (from python-gitlab) (2.13.0)
Installing collected packages: python-gitlab
Successfully installed python-gitlab-1.5.1
Run Code Online (Sandbox Code Playgroud)

我正在使用 Python 3.6.4。我究竟做错了什么?