AtCoder用にPythonの環境構築

本記事は以前Qiitaに投稿した内容を本ブログに持ってきています。 はじめに 最近、AtCoderを始めました。 AtCoderは競技プログラミングサイトで、毎週リアルタイムのコンテストが開催されていて、AtCoderで評価されたレーティングを利用して、転職活動ができるAtCoderJobsというサービスが話題になっているそうです。 最初、シェルがfishでHomebrewなどが入っている状態で色々試していましたが、うまくいかなかったので、Mac環境をきれいにして環境構築をしました。 環境 macOS Catalina 10.15.2 Homebrew 2.1.15 bash 3.2.57 シェルをbashに戻す ターミナルで以下コマンドを叩いて、ターミナルの再起動をするとシェルがbashに戻ります。 $ chsh -s /bin/bash Homebrewをアンインストールする 以下コマンドを叩いてパスワードを入力すると、Homebrewをアンインストールできます。 $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" Homebrewの公式サイトに記載されています。 Homebrewインストールする 以下コマンドを叩く。 $ usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" インストールできたか確認するために、以下コマンドを叩きます。 $ brew doctor すると、Warningが大量に出たので、brew doctorでWarningが出たので解決方法まとめました。(for Mac)を参考に解決しました。 Warning: Unbrewed dylibs were found in /usr/local/include. のログに関しては残すことを忘れてしまっていたので、上記記事を引用しています。 Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks! Warning: Unbrewed header files were found in /usr/local/include. If you didn't put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted. Unexpected header files: /usr/local/include/arith.h /usr/local/include/binary_log_types.h /usr/local/include/cdt.h /usr/local/include/cgraph.h /usr/local/include/color.h /usr/local/include/decode.h /usr/local/include/demux.h /usr/local/include/encode.h /usr/local/include/errmsg.h /usr/local/include/fcfreetype.h /usr/local/include/fcprivate.h /usr/local/include/fontconfig.h /usr/local/include/freetype/config/ftconfig.h /usr/local/include/freetype/config/ftheader.h /usr/local/include/freetype/config/ftmodule.h /usr/local/include/freetype/config/ftoption.h /usr/local/include/freetype/config/ftstdlib.h /usr/local/include/freetype/freetype.h /usr/local/include/freetype/ftadvanc.h /usr/local/include/freetype/ftbbox.h /usr/local/include/freetype/ftbdf.h /usr/local/include/freetype/ftbitmap.h /usr/local/include/freetype/ftbzip2.h /usr/local/include/freetype/ftcache.h /usr/local/include/freetype/ftchapters.h /usr/local/include/freetype/ftcid.h /usr/local/include/freetype/ftdriver.h /usr/local/include/freetype/fterrdef.h /usr/local/include/freetype/fterrors.h /usr/local/include/freetype/ftfntfmt.h /usr/local/include/freetype/ftgasp.h /usr/local/include/freetype/ftglyph.h /usr/local/include/freetype/ftgxval.h /usr/local/include/freetype/ftgzip.h /usr/local/include/freetype/ftimage.h /usr/local/include/freetype/ftincrem.h /usr/local/include/freetype/ftlcdfil.h /usr/local/include/freetype/ftlist.h /usr/local/include/freetype/ftlzw.h /usr/local/include/freetype/ftmac.h /usr/local/include/freetype/ftmm.h /usr/local/include/freetype/ftmodapi.h /usr/local/include/freetype/ftmoderr.h /usr/local/include/freetype/ftotval.h /usr/local/include/freetype/ftoutln.h /usr/local/include/freetype/ftparams.h /usr/local/include/freetype/ftpfr.h /usr/local/include/freetype/ftrender.h /usr/local/include/freetype/ftsizes.h /usr/local/include/freetype/ftsnames.h /usr/local/include/freetype/ftstroke.h /usr/local/include/freetype/ftsynth.h /usr/local/include/freetype/ftsystem.h /usr/local/include/freetype/fttrigon.h /usr/local/include/freetype/fttypes.h /usr/local/include/freetype/ftwinfnt.h /usr/local/include/freetype/t1tables.h /usr/local/include/freetype/ttnameid.h /usr/local/include/freetype/tttables.h /usr/local/include/freetype/tttags.h /usr/local/include/ft2build.h /usr/local/include/geom.h /usr/local/include/graphviz_version.h /usr/local/include/gvc.h /usr/local/include/gvcext.h /usr/local/include/gvcjob.h /usr/local/include/gvcommon.h /usr/local/include/gvconfig.h /usr/local/include/gvplugin.h /usr/local/include/gvplugin_device.h /usr/local/include/gvplugin_layout.h /usr/local/include/gvplugin_loadimage.h /usr/local/include/gvplugin_render.h /usr/local/include/gvplugin_textlayout.h /usr/local/include/gvpr.h /usr/local/include/lt_dlloader.h /usr/local/include/lt_error.h /usr/local/include/lt_system.h /usr/local/include/mux.h /usr/local/include/mux_types.h /usr/local/include/my_command.h /usr/local/include/my_list.h /usr/local/include/mysql.h /usr/local/include/mysql/client_plugin.h /usr/local/include/mysql/plugin_auth_common.h /usr/local/include/mysql/udf_registration_types.h /usr/local/include/mysql_com.h /usr/local/include/mysql_time.h /usr/local/include/mysql_version.h /usr/local/include/mysqld_error.h /usr/local/include/mysqlx_ername.h /usr/local/include/mysqlx_error.h /usr/local/include/mysqlx_version.h /usr/local/include/pack.h /usr/local/include/pathgeom.h /usr/local/include/pathplan.h /usr/local/include/png.h /usr/local/include/pngconf.h /usr/local/include/textspan.h /usr/local/include/types.h /usr/local/include/usershape.h /usr/local/include/xdot.h Warning: Your Xcode (10.3) is outdated. Please update to Xcode 11.3 (or delete it). Xcode can be updated from the App Store. Warning: Broken symlinks were found. Remove them with `brew cleanup`: /usr/local/lib/node_modules/expo-cli/node_modules/.bin/detect-libc /usr/local/lib/node_modules/expo-cli/node_modules/.bin/prebuild-install まずは、Warning: Unbrewed header files were found in /usr/local/include.の解決をします。 ...

March 16, 2020 · 6 min · 1133 words · Yu

GoでインストールからHello Golang!!

本記事は以前Qiitaに投稿した内容を本ブログに持ってきています。 概要 MacにGoをインストールして、「Hello Golang!!」を表示させるところまでを解説していきます。 また、僕はシェルにfishを使っているので、fish向けの環境構築についても記載します。 環境 macOS Catalina 10.15.1 Homebrew 2.1.15 fish 3.0.2 Goインストール $ brew install go $ go version go version go1.13.3 darwin/amd64 Homebrew使うとコマンド一つでインストールできるので、とても便利です。 GOPATHの設定 GOPATHとは、Goのソースをまとめているディレクトリを指定している環境変数のことであり、 GOPATHを利用することで、外部ライブラリの導入やビルド作業を非常に簡単に行うことができます。 bashでGOPATHを指定するには、 $ vim ~/.bash_profile で設定ファイルに以下追記をします。 export GOPATH=$HOME/go(←ワークスペースにしたい場所) export PATH=$PATH:$GOPATH/bin 僕のようにシェルにfishを使っている人は、 vim ~/.config/fish/config.fish で設定ファイルに以下追記をします。 set -x GOPATH $HOME/go set -x PATH $PATH $GOPATH/bin これでGOPATHの設定は完了です。 Hello Golang!! ではいよいよ「Hello Golang!!」を表示させていきます。 ディレクトリ構成 最終的に以下構成になります。 go/ ┣ bin/ ┣ hellogolang ┣ pkg/ ┣ src/ ┣ hellogolang/ ┣ main.go 以下ファイルのそれぞれの役割に関して記載します。 bin: 実行ファイルが格納されるディレクトリ pkg: ビルドしたパッケージオブジェクトが格納されるディレクトリ src: パッケージごとのソースが格納されるディレクトリ ...

March 16, 2020 · 1 min · 111 words · Yu