mac版pip install --upgrade pip 更新版本出錯

報錯信息:python

➜  ~ sudo  pip install --upgrade pipmysql

Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    74% |███████████████████████▊        | 888kB 21kB/s eta 0:00:15Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 282, in run
    requirement_set.prepare_files(finder)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 334, in prepare_files
    functools.partial(self._prepare_file, finder))
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 321, in _walk_req_to_install
    more_reqs = handler(req_to_install)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 491, in _prepare_file
    session=self.session)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/download.py", line 825, in unpack_url
    session,
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/download.py", line 673, in unpack_http_url
    from_path, content_type = _download_http_url(link, session, temp_dir)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/download.py", line 886, in _download_http_url
    _download_url(resp, link, content_file)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/download.py", line 621, in _download_url
    for chunk in progress_indicator(resp_read(4096), 4096):
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/ui.py", line 133, in iter
    for x in it:
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/download.py", line 586, in resp_read
    decode_content=False):
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/response.py", line 307, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/response.py", line 267, in read
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.sql

 

解決方案:sudo pip  install --index https://pypi.mirrors.ustc.edu.cn/simple/ --upgrade pipsession

安裝MySQLdb-python出錯ui

➜  ~ pip install MySQL-python
Collecting MySQL-python
  Using cached MySQL-python-1.2.5.zip
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/rj/lcp0d7815kl2v5xh0j4zm6h00000gn/T/pip-build-tD7Et4/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not foundurl

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/rj/lcp0d7815kl2v5xh0j4zm6h00000gn/T/pip-build-tD7Et4/MySQL-python/spa

 

解決方案:brew install mysqlcode

             sudo pip install MySQL-pythonip

相關文章
相關標籤/搜索