zoukankan      html  css  js  c++  java
  • python pip install 报错TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' Command "python setup.py egg_info" failed with error code 1 in

    pip install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl 
    pip install torchvision

    今天在按照上面的命令安装pytorch的时候,首先将whl文件下载到本地,然后直接pip install该文件,再安装的时候报错,TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' ,

    这个问题我是修改了pip的源解决的,参考这篇博客,将豆瓣源写到相应的文件中,然后第一步就成功了。

    安装完第一步之后,再执行pip install torchvision的时候,又出现了如下的问题:这个是由于pip的版本太低引起的,后来搜到了这篇博客,运行如下的命令对pip进行升级:

    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-NQWkHo/torch/
    sudo python -m pip install --upgrade --force pip

    然后就安装成功了

    后面在使用python setup.py的时候,又出现了问题,从显示的信息是网络连接不上,默认是从这个网址进行下载https://pypi.python.org/simple/,

    然后搜到了这篇博客,也就是pip install与通过python setup.py文件进行安装是解析的不同的文件,这个则需要建立~/.pydistutils.cfg来配置distutils的源

    ~/.pydistutils.cfg

    1
    2
    
    [easy_install]
    index_url = http://pypi.douban.com/simple

    将该文件编辑保存之后,再次运行 python setup.py很快就可以装上了。

    后来豆瓣源不起作用了,又换成了清华源:

    gedit ~/.pip/pip.conf

    [global] 
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    [install] 
    trusted-host=pypi.douban.com
  • 相关阅读:
    AcWing 852. spfa判断负环 边权可能为负数。
    面试题 02.01. 移除重复节点
    1114. 按序打印
    剑指 Offer 38. 字符串的排列
    557. 反转字符串中的单词 III
    645. 错误的集合
    面试题 05.03. 翻转数位
    1356. 根据数字二进制下 1 的数目排序
    748. 最短完整词
    剑指 Offer 32
  • 原文地址:https://www.cnblogs.com/rainsoul/p/7730390.html
Copyright © 2011-2022 走看看