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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM