TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' 解決方案

2019-01-11
pip安裝錯(cuò)誤贬派,pip換源結(jié)局問題
錯(cuò)誤代碼:

[sudo] password for changhengyu: 
The directory '/home/changhengyu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/changhengyu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting Wand
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run
    requirement_set.prepare_files(finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
    finder, self.upgrade, require_hashes)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page
    "Cache-Control": "max-age=600",
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send
    timeout=timeout
  File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment
    total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

解決方案:參考網(wǎng)址
據(jù)說還可以提高pip下載速度

修改文件~/.pip/pip.conf (沒有就創(chuàng)建一個(gè))
在文件中添加:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

這次重裝基本都用的清華的源 解決了上面這個(gè)錯(cuò)誤

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末急但,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子搞乏,更是在濱河造成了極大的恐慌波桩,老刑警劉巖,帶你破解...
    沈念sama閱讀 212,383評(píng)論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件请敦,死亡現(xiàn)場離奇詭異镐躲,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)侍筛,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,522評(píng)論 3 385
  • 文/潘曉璐 我一進(jìn)店門萤皂,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人匣椰,你說我怎么就攤上這事裆熙。” “怎么了禽笑?”我有些...
    開封第一講書人閱讀 157,852評(píng)論 0 348
  • 文/不壞的土叔 我叫張陵入录,是天一觀的道長。 經(jīng)常有香客問我佳镜,道長僚稿,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,621評(píng)論 1 284
  • 正文 為了忘掉前任蟀伸,我火速辦了婚禮蚀同,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘啊掏。我一直安慰自己蠢络,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,741評(píng)論 6 386
  • 文/花漫 我一把揭開白布脖律。 她就那樣靜靜地躺著谢肾,像睡著了一般。 火紅的嫁衣襯著肌膚如雪小泉。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,929評(píng)論 1 290
  • 那天冕杠,我揣著相機(jī)與錄音微姊,去河邊找鬼。 笑死分预,一個(gè)胖子當(dāng)著我的面吹牛兢交,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播笼痹,決...
    沈念sama閱讀 39,076評(píng)論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼配喳,長吁一口氣:“原來是場噩夢啊……” “哼酪穿!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起晴裹,我...
    開封第一講書人閱讀 37,803評(píng)論 0 268
  • 序言:老撾萬榮一對(duì)情侶失蹤被济,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后涧团,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體只磷,經(jīng)...
    沈念sama閱讀 44,265評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,582評(píng)論 2 327
  • 正文 我和宋清朗相戀三年泌绣,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了钮追。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,716評(píng)論 1 341
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡阿迈,死狀恐怖元媚,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情苗沧,我是刑警寧澤刊棕,帶...
    沈念sama閱讀 34,395評(píng)論 4 333
  • 正文 年R本政府宣布,位于F島的核電站崎页,受9級(jí)特大地震影響鞠绰,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜飒焦,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,039評(píng)論 3 316
  • 文/蒙蒙 一蜈膨、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧牺荠,春花似錦翁巍、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,798評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至杈曲,卻和暖如春驰凛,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背担扑。 一陣腳步聲響...
    開封第一講書人閱讀 32,027評(píng)論 1 266
  • 我被黑心中介騙來泰國打工恰响, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人涌献。 一個(gè)月前我還...
    沈念sama閱讀 46,488評(píng)論 2 361
  • 正文 我出身青樓胚宦,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子枢劝,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,612評(píng)論 2 350

推薦閱讀更多精彩內(nèi)容