LoginSignup
17
9

More than 5 years have passed since last update.

MacでPythonが動かない状況をなんとか解決

Posted at

こんにちは。

AWSの学習をするため、
Macにawscliを入れたかったのでPythonを利用としたところ、
まさかのエラーがでて動かないという状況が発生。

-bash: /usr/local/bin/python: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

調査で色々いじっていたので、変なところをいじってしまったのかも。
そもそも、/usr/local/opt/python/bin/python2.7なんてファイル存在しれない。

色々試してけど、UNIXほとんど触ったことない私にはまったく見当もつかず。
一旦pythonをアンインストールして、再インストール。
が、、、状況変わらず。

インストールログを確認していたら、エラーがあることに気がつく。

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
  rm '/usr/local/bin/2to3'

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

シンボリックがすでに存在していて、更新できていなかったよう。

  brew link --overwrite python

上記コマンドを実行して、動きました!

$ python 
Python 2.7.10 (default, Sep 23 2015, 04:34:14) 

まだまだ、勉強不足のことが多いので少しずつ勉強します。
とりあえず、AWSの勉強は初められそう。

17
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
9