2017-02-01 4 views
1

Um Python-Pakete zu installieren, müssen Sie pip installiert haben. Sehr klare Anweisungen sind hier zu finden: https://packaging.python.org/installing/Fehler bei der Installation von pip für Python

Wenn jedoch Pip über python get-pip.py zu installieren versucht, ich die folgende Fehlermeldung:

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

Ohne Erfolg, ich habe versucht, den Rat auf GitHub folgen (https://github.com/pypa/pip/issues/3761), um meine Berechtigungen zu ändern und den Systemintegritätsschutz zu deaktivieren, den Sie unter diesem Link finden (http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/).

Beachten Sie auch, dass pip nicht auf meinem Rechner nicht vorhanden ist:

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

ich OSX 10.12.2 renne.

+1

pip sollte bereits mit Python 2.7 –

+0

installiert Kommen Sie versuchen Python Neuinstallation und wählen Sie "Benutzerdefinierte Installation" unter "Wählen Sie" Pip-Paket installieren ". –

+0

Oder, um genauer zu sein, von Ihrem Link: 'Wenn Sie Python 2> = 2.7.9 oder Python 3> = 3.4 von python.org installiert haben, haben Sie bereits pip und setuptools, müssen aber auf die aktualisieren neueste Version ... ' –

Antwort

0

Lösung:

Nach Tristans versucht & Coolq B Vorschlag sudo python get-pip.py es funktionierte. Allerdings, wenn Sie nicht erfolgreich sind, versuchen Sie es erneut: Nach dem ersten Versuch habe ich einen Timeout-Fehler festgestellt. Ich habe es erneut versucht und es hat funktioniert. Beide Ergebnisse veröffentlicht:

Erster Versuch (Timeout-Fehler):

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. 

zweiten Versuch (Erfolg):

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 
Verwandte Themen