Help us understand the problem. What is going on with this article?

zshの切替とPyhton3の再設定

macOS Catalina の標準シェルがzshになったとのことで、
terminalでも切替えの促しがありシェル変更(change shell)コマンドchshを実行

chsh -s /bin/zsh

その後にPythonのプログラムを実行すると、エラーが。。

SyntaxError: Non-ASCII character '\xe8...'

ググると、utf-8の文字コードの宣言が冒頭に必要と。。
# -*- coding: utf-8 -*-

でも今まで普通に動いてたのにと思い、もう少し調べると、、
Python3ではutf−8はデフォルト設定、
Python2ではutf−8の文字コード宣言が必要との記載が。。

そこでPhytonでバージョンを確認すると、Python2と判明。。
最初からPython3使ってたから意識してなかった。。

Anacondaを使ってるので、

/opt/anaconda3/bin/conda init zsh

でPython3に切り替えて無事解決!

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした