0

Macbook Air で OSX Yosemite を実行しています。python3 とアップル開発者パッケージがインストールされています。matplotlib を含め、既にインストールしたモジュールと同様のモジュールをインストールしようとしています。基本的に、SciPy、Ginga、AstroPy、iPython などの科学的な python パッケージをインストールしようとすると、pip のインストールを試みた後にターミナルに次のように表示されます。

-bash: pip: command not found

そのため、提供されている場合は tarball をダウンロードしようとし、Web サイトと README ファイルに従ってその方法でインストールするための指示に従いますが、それでもエラーが発生します。たとえば、この astropy tarball では、ディレクトリから python setup.py install を実行するように指定されており、次のようになります。

jesses-Air:astropy-1.0 jessehanowell$ python setup.py install
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
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-632.pth'

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:

https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.

「python3 setup.py install」コマンドでも同じことが言えます。python3 がインストールされていて、Yosemite はまだ python v2.4.7 で実行されており、ファイルが置かれているダウンロード ディレクトリからターミナルを実行していることに注意してください。ファイルを解凍したファイルを新しい場所に変更する必要があるのでしょうか? しかし、これらのパッケージの使い方を本当に学びたいので、基本的にはがっかりしています。私の友人がmatplotlibをインストールできたかどうか、私はこれらをインストールできるはずだと知っています。

それで、pipを私のコンピューターに復元してその方法でインストールする方法はありますか? または、誰かが私が間違ってやっている明らかなことを指摘できますか? 助けてくれてありがとう!

4

2 に答える 2

3

他の返信を読んでいる人のために、許可エラーをバイパスするために使用するべきではないsudoことを強調する必要があります。代わりに、次のようにインストールコマンドを実行してください。

python setup.py install --user

Libraryこれにより、パッケージがホーム ディレクトリにインストールされます。

一般に、 Mac に Scientific Python ディストリビューションをインストールするには、 Anaconda Python ディストリビューションを使用することをお勧めします (デフォルトで Numpy、SciPy、Astropy などが含まれます)。

于 2015-02-22T09:38:03.003 に答える
-1

許可が拒否される問題は通常、コマンドの前に sudo を付ける必要があることを意味します。

自作でpythonをインストールすることを含む、私が行った投稿は次のとおりです。

https://rlkamradt.wordpress.com/2015/02/14/setting-up-a-development-environment-on-a-mac-languages/

于 2015-02-22T00:38:45.727 に答える