CentOS 7.3安裝pip問題記錄

2017-11-28  本文已影响0人  鬼王丶

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:

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:

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

上一篇下一篇

猜你喜欢

热点阅读