2017-02-01 2 views
1

Для установки пакетов python необходимо установить pip. Очень четкие инструкции можно найти здесь: https://packaging.python.org/installing/Ошибка установки пипса для Python

Однако при попытке установить пип через python get-pip.py я получаю следующее сообщение об ошибке:

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'

без толка, я пытался следовать советам на GitHub (https://github.com/pypa/pip/issues/3761), чтобы изменить мои разрешения и отключить защиту целостности системы, найденную по этой ссылке (http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/).

Кроме того, обратите внимание, что pip не существует на моей машине:

Myname-MBP:python myname$ pip 
-bash: pip: command not found 

Я бегу OSX 10.12.2.

+1

пип должны уже предустановленными с питоном 2,7 –

+0

Попробуйте переустановить питона и выберите «Пользовательская установка» под ним, просто выберите «Установить пакет pip». –

+0

Или, точнее, из вашей ссылки: 'Если у вас есть Python 2> = 2.7.9 или Python 3> = 3.4, установленный с python.org, у вас уже будут пункты pip и setuptools, но вам нужно будет перейти на последняя версия ... ' –

ответ

0

Решение:

После попытки & предложение Тристана Coolq Б sudo python get-pip.py он работал. Однако, если вам сначала не удастся, повторите попытку: после первой попытки я испытал ошибку тайм-аута. Я попробовал еще раз, и это сработало. Оба результата отвечал:

Первая попытка (ошибка тайм-аута):

Myname-MBP:python myname$ sudo python get-pip.py 
Password: 
The directory '/Users/myname/Library/Caches/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 '/Users/myname/Library/Caches/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 pip 
     Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 
     19% |██████▎       | 245kB 11kB/s eta 0:01:32Exception: 
    Traceback (most recent call last): 
     File "/tmp/tmpq4Sjum/pip.zip/pip/basecommand.py", line 215, in main 
     status = self.run(options, args) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/commands/install.py", line 324, in run 
     requirement_set.prepare_files(finder) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/req/req_set.py", line 380, in prepare_files 
     ignore_dependencies=self.ignore_dependencies)) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/req/req_set.py", line 620, in _prepare_file 
     session=self.session, hashes=hashes) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 821, in unpack_url 
     hashes=hashes 
     File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 659, in unpack_http_url 
     hashes) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 882, in _download_http_url 
     _download_url(resp, link, content_file, hashes) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 603, in _download_url 
     hashes.check_against_chunks(downloaded_chunks) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/utils/hashes.py", line 46, in check_against_chunks 
     for chunk in chunks: 
     File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 571, in written_chunks 
     for chunk in chunks: 
     File "/tmp/tmpq4Sjum/pip.zip/pip/utils/ui.py", line 139, in iter 
     for x in it: 
     File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 560, in resp_read 
     decode_content=False): 
     File "/tmp/tmpq4Sjum/pip.zip/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream 
     data = self.read(amt=amt, decode_content=decode_content) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/_vendor/requests/packages/urllib3/response.py", line 324, in read 
     flush_decoder = True 
     File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ 
     self.gen.throw(type, value, traceback) 
     File "/tmp/tmpq4Sjum/pip.zip/pip/_vendor/requests/packages/urllib3/response.py", line 246, in _error_catcher 
     raise ReadTimeoutError(self._pool, None, 'Read timed out.') 
    ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out. 

Второй Try (успех):

MyName-MBP:python myname$ sudo python get-pip.py 
Password: 
The directory '/Users/myname/Library/Caches/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 '/Users/myname/Library/Caches/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 pip 
    Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 
    100% |████████████████████████████████| 1.3MB 143kB/s 
Collecting wheel 
    Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB) 
    100% |████████████████████████████████| 71kB 72kB/s 
Installing collected packages: pip, wheel 
Successfully installed pip-9.0.1 wheel-0.29.0 
Смежные вопросы