OS X Lion easy_install erfordert Sudo ...?

5713
w--

Ich bin auf OS X Lion und möchte virtuelle Python-Umgebungen einrichten. Ich möchte virtualenvwrapper verwenden.

Kann jemand bestätigen, dass der korrekte Weg, dies zu tun, darin besteht, Pakete über easy_install zu installieren (und anschließend pip), dann sudo verwenden

Kontext: um virtaulenv zu installieren, wollte ich pip verwenden

$ easy_install pip error: can't create or remove files in install directory  The following error occurred while trying to add or remove files in the installation directory:  [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-876.write-test'  The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:  /Library/Python/2.7/site-packages/  Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable.  For information on other options, you may wish to consult the documentation at:  http://peak.telecommunity.com/EasyInstall.html  Please make the appropriate changes for your system and try again. 

Es scheint, dass ich easy_install nur mit sudo verwenden kann. Ich habe an anderer Stelle gelesen, dass dies eine schlechte Idee ist (obwohl ich mir nicht ganz sicher ist, warum).

Zu klären,

$ which python /usr/bin/python 

und es ist 2.7.1.

7

3 Antworten auf die Frage

4
Emily Chen

/Library/Python/2.7/site-packages/ World-Executable erstellen mit:

sudo chmod -R 755 /Library/Python/2.7/site-packages 

arbeitete für mich

1
Debilski

Vor Lion /Library/Pythonwar der Benutzer standardmäßig schreibgeschützt (es sei denn, Sie haben sudo easy_installeinmal mit dem Gebrauch begonnen, danach waren die neu erstellten Dateien nicht mehr schreibgeschützt). Mit Lion hat sich dies geändert, obwohl nicht klar ist, warum. Sie können also entweder den Eigentümer ändern /Library/Pythonoder sudoalle easy_installAktionen hinzufügen .

Weitere Informationen finden Sie im Homebrew-Wiki .

chmod + a 'user: YOUR_NAME_HERE erlaubt add_subdirectory, add_file, delete_child, directory_inherit' /Library/Python/2.7/site-packages tzs vor 11 Jahren 1
1
coto

Downloading setuptools again and installing it with this command will fix your problem.

sudo sh setuptools-0.6c11-py2.7.egg --prefix=~ --install-dir=/Library/Python/2.7/site-packages/