CentOS 7.3安裝pip問題記錄

CentOS 7.3 安裝 Python2.7.9,然後使用軟鏈接以pythonu引用python2.7.9中的python2.7。在後續使用過程中需要安裝pip,以下爲安裝時的問題記錄。

1.Question 1

[hanzo@hanzo Laboratory]$ pythonu get-pip.py 
Traceback (most recent call last):
  File "get-pip.py", line 20061, in <module>
    main()
  File "get-pip.py", line 194, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available

Solution:

    1. 依赖於zlib(已安裝)、zlib-devel(yum install -y zlib-devel)。
    1. 重新编译安装Python2.7.9

2.Question 2

[root@hanzo Laboratory]# pythonu get-pip.py 
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pip
Exception:
Traceback (most recent call last):
  File "/tmp/tmpL7hCZj/pip.zip/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/tmp/tmpL7hCZj/pip.zip/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/tmp/tmpL7hCZj/pip.zip/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/tmp/tmpL7hCZj/pip.zip/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/tmp/tmpL7hCZj/pip.zip/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/tmp/tmpL7hCZj/pip.zip/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/tmp/tmpL7hCZj/pip.zip/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/tmp/tmpL7hCZj/pip.zip/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/tmp/tmpL7hCZj/pip.zip/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/tmp/tmpL7hCZj/pip.zip/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/tmp/tmpL7hCZj/pip.zip/pip/_vendor/requests/sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "/tmp/tmpL7hCZj/pip.zip/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/tmp/tmpL7hCZj/pip.zip/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/tmp/tmpL7hCZj/pip.zip/pip/_vendor/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/tmp/tmpL7hCZj/pip.zip/pip/_vendor/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/tmp/tmpL7hCZj/pip.zip/pip/_vendor/requests/adapters.py", line 390, in send
    conn = self.get_connection(request.url, proxies)
  File "/tmp/tmpL7hCZj/pip.zip/pip/_vendor/requests/adapters.py", line 290, in get_connection
    proxy_manager = self.proxy_manager_for(proxy)
  File "/tmp/tmpL7hCZj/pip.zip/pip/_vendor/requests/adapters.py", line 184, in proxy_manager_for
    **proxy_kwargs
  File "/tmp/tmpL7hCZj/pip.zip/pip/_vendor/requests/adapters.py", line 43, in SOCKSProxyManager
    raise InvalidSchema("Missing dependencies for SOCKS support.")
InvalidSchema: Missing dependencies for SOCKS support.

Solution:

  • 1.依賴於openssl(已安裝)、openssl-devel(yum install -y openssl-devel)
  • 2.重新執行pythonu get-pip.py,若依然出現以下問題,則重新编译安装Python2.7.9
    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    

3.Question 3

[root@hanzo Laboratory]# pythonu get-pip.py 
Collecting pip
Exception:
Traceback (most recent call last):
  File "/tmp/tmpr9m_gN/pip.zip/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/tmp/tmpr9m_gN/pip.zip/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/tmp/tmpr9m_gN/pip.zip/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/tmp/tmpr9m_gN/pip.zip/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/tmp/tmpr9m_gN/pip.zip/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/tmp/tmpr9m_gN/pip.zip/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/tmp/tmpr9m_gN/pip.zip/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/tmp/tmpr9m_gN/pip.zip/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/tmp/tmpr9m_gN/pip.zip/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/tmp/tmpr9m_gN/pip.zip/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/tmp/tmpr9m_gN/pip.zip/pip/_vendor/requests/sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "/tmp/tmpr9m_gN/pip.zip/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/tmp/tmpr9m_gN/pip.zip/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/tmp/tmpr9m_gN/pip.zip/pip/_vendor/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/tmp/tmpr9m_gN/pip.zip/pip/_vendor/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/tmp/tmpr9m_gN/pip.zip/pip/_vendor/requests/adapters.py", line 390, in send
    conn = self.get_connection(request.url, proxies)
  File "/tmp/tmpr9m_gN/pip.zip/pip/_vendor/requests/adapters.py", line 290, in get_connection
    proxy_manager = self.proxy_manager_for(proxy)
  File "/tmp/tmpr9m_gN/pip.zip/pip/_vendor/requests/adapters.py", line 184, in proxy_manager_for
    **proxy_kwargs
  File "/tmp/tmpr9m_gN/pip.zip/pip/_vendor/requests/adapters.py", line 43, in SOCKSProxyManager
    raise InvalidSchema("Missing dependencies for SOCKS support.")
InvalidSchema: Missing dependencies for SOCKS support.

Solution:
以下爲內網代理設置:

[root@hanzo Python-2.7.9]# env | grep -i all_proxy
all_proxy=socks://proxy1.bj.xxx:8080/
ALL_PROXY=socks://proxy1.bj.xxx:8080/

清除socks代理設置:

[root@hanzo Laboratory]# export ALL_PROXY="" && export all_proxy=""
[root@hanzo Laboratory]# env | grep -i all_proxy
all_proxy=
ALL_PROXY=

加上代理選項(--proxy)執行:

[root@hanzo Laboratory]# pythonu get-pip.py --proxy="http://proxy1.bj.xxx:8080"
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 85kB/s 
Collecting setuptools
  Downloading setuptools-38.2.3-py2.py3-none-any.whl (489kB)
    100% |████████████████████████████████| 491kB 99kB/s 
Collecting wheel
  Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 88kB/s 
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-9.0.1 setuptools-38.2.3 wheel-0.30.0

相關閱讀:
Installation — pip 9.0.1 documentation

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 162,158评论 4 370
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 68,600评论 1 307
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 111,785评论 0 254
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,655评论 0 220
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 53,075评论 3 295
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 41,002评论 1 225
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 32,146评论 2 318
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,918评论 0 211
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,671评论 1 250
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,838评论 2 254
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,318评论 1 265
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,636评论 3 263
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,343评论 3 244
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,187评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,982评论 0 201
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 36,126评论 2 285
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,934评论 2 279

推荐阅读更多精彩内容