无法使用pip

时间:2019-04-02 20:51:28

标签: git pip install

我需要在Linux下安装pycocotoolsHere表示我可以做到

pip install git+https://github.com/waleedka/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI

但是,当我从虚拟环境my_env执行上述命令时,会得到以下答案:

(my_venv) ...:~/Mask_RCNN$ pip install git+https://github.com/waleedka/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI
[1] 22087
(my_venv) ....:~/Mask_RCNN$ Collecting pycocotools from git+https://github.com/waleedka/cocoapi.git#egg=pycocotools
  Cloning https://github.com/waleedka/cocoapi.git to /tmp/pip-build-qo_7ubcm/pycocotools
Username for 'https://github.com':

这时,由于git提示我输入用户名,因此我使用了GitHub用户名,但是从答案中我想它是在寻找存储库所有者的用户名(和密码?)

 MyUserName
MyUserName: command not found

[1]+  Stopped                 pip install git+https://github.com/waleedka/cocoapi.git#egg=pycocotools

[1]+  Stopped                 pip install git+https://github.com/waleedka/cocoapi.git#egg=pycocotools

安装失败。另外,显然现在我的背景工作很忙:

ps
  PID TTY          TIME CMD
20079 pts/0    00:00:00 bash
22087 pts/0    00:00:00 pip
22094 pts/0    00:00:00 git
22095 pts/0    00:00:00 git-remote-http
22390 pts/0    00:00:00 ps

如何安装pycocotools的正确分支?

1 个答案:

答案 0 :(得分:2)

我的建议是,您需要使用引号'来处理命令的此部分&中的与号&subdirectory=PythonAPI运算符。

似乎仓库https://github.com/waleedka/cocoapi/已移至https://github.com/waleedka/coco/

因此,我尝试了此命令,它不需要我进行身份验证,但由于未安装Cython而失败:

sanyash@sanyash-ub16:~$ pip3 install 'git+https://github.com/waleedka/coco.git#egg=pycocotools&subdirectory=PythonAPI'

Collecting pycocotools from git+https://github.com/waleedka/coco.git#egg=pycocotools&subdirectory=PythonAPI
  Cloning https://github.com/waleedka/coco.git to ./pip-build-2pxyynzt/pycocotools
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-2pxyynzt/pycocotools/PythonAPI/setup.py", line 2, in <module>
        from Cython.Build import cythonize
    ImportError: No module named 'Cython'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2pxyynzt/pycocotools/PythonAPI

尽管我无法向您展示pycocotools的完整安装,希望我的回答对您有所帮助。

相关问题