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
  • 相关阅读:
    cytoscape-d3-force api
    Python基础编程 模块的引入与定义
    更改Ubuntu内核版本
    Jupyter Notebook默认路径修改
    YJZH 前端部署记录 CentOS+Nginx+Vue
    dotnet core webapi centos 服务自启动
    Linux修改时区
    空间数据实战(1)——MySQL
    记录window.sessionStorage的一个小坑
    ElementUI默认表单项el-form-item间距修改
  • 原文地址:https://www.cnblogs.com/rainsoul/p/7730390.html
Copyright © 2011-2022 走看看