macにpython3の環境を構築

以前はanacondaのインストーラから環境をつくったが コマンドラインからPythonを実行する方法がわからなかったので MacにPython3をインストールし環境構築【決定版】 を参考に環境を構築した。OSはHigh Sierra

インストール

brew install python3
python3 -V
pip3 install virtualenv

開発ディレクトリでPython3の環境を切り離す

cd <開発ディレクトリ>
virtualenv --python=/usr/local/bin/python3 --no-site-packages env

アクティベイト(これはpython3の環境に切り替えるとき毎回実行する)

source env/bin/activate

ディアクティベイトは下記のコマンド

deactivate

まだ環境をつくっただけ

みんなでSwift復習会 GO! in 京都初参加

最近仕事でもプライベートでもSwiftを書いていないので大丈夫かなーと思いながら1/13に「みんなでSwift復習会 GO!」に初参加した。

脱線や談笑を歓迎している勉強会だけに、前で話す人は1人だけど聞き手も普通に話すし、Macbookの画面もAirPlay経由で共有することができて聞いている人がコードを見せて説明するシーンもあった。

今日は教科書「The Swift Programming Lanuage」の最初の方の制御文(for in)をやるはずだったのに、Sequenceプロトコルに準拠するとプロトコルに用意されている様々な機能を使える、という話になっていった。

いい雰囲気の勉強会だったのでまた参加したい。

atomでキーボードマクロ

atomテキストエディタとして使いたい。

テキストエディタで繰り返しの単純作業をすることがあるのでキーボードマクロを使いたいなーと思ってパッケージを探してみた。

最初に見つかったのが次のパッケージ。

 

atom.io

 

インストールしようとすると

npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
gyp ERR! configure error
gyp ERR! stack Error: Python executable "/Applications/Atom.app/Contents/Resources/app/apm/bin/python-interceptor.sh" is v3.6.3, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack at failPythonVersion (/Applications/Atom.app/Contents/Resources/app/apm/node_modules/node-gyp/lib/configure.js:454:14)
gyp ERR! stack at /Applications/Atom.app/Contents/Resources/app/apm/node_modules/node-gyp/lib/configure.js:443:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:197:7)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
gyp ERR! stack at Socket.<anonymous> (internal/child_process.js:334:11)
gyp ERR! stack at emitOne (events.js:96:13)
gyp ERR! stack at Socket.emit (events.js:188:7)
gyp ERR! stack at Pipe._handle.close [as _onclose] (net.js:498:12)
gyp ERR! System Darwin 17.3.0
gyp ERR! command "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /private/var/folders/26/7wgn78s12bx0wgk4mqn27r640000gn/T/apm-install-dir-118012-31694-184pxze.ab5qj8aor/node_modules/atom-keyboard-macros/node_modules/keyboard-layout
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/private/var/folders/26/7wgn78s12bx0wgk4mqn27r640000gn/T/apm-install-dir-118012-31694-184pxze.ab5qj8aor/package.json'
npm WARN apm-install-dir-118012-31694-184pxze.ab5qj8aor No description
npm WARN apm-install-dir-118012-31694-184pxze.ab5qj8aor No repository field.
npm WARN apm-install-dir-118012-31694-184pxze.ab5qj8aor No README data
npm WARN apm-install-dir-118012-31694-184pxze.ab5qj8aor No license field.
npm ERR! Darwin 17.3.0
npm ERR! argv "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Users/arimotojungo/.atom/.apm/.apmrc" "--userconfig" "/Users/arimotojungo/.atom/.apmrc" "install" "/private/var/folders/26/7wgn78s12bx0wgk4mqn27r640000gn/T/d-118012-31694-1yhbqtf.4t9cgi7ldi/package.tgz" "--runtime=electron" "--target=1.6.15" "--arch=x64" "--global-style"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! keyboard-layout@2.0.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keyboard-layout@2.0.13 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the keyboard-layout package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs keyboard-layout
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls keyboard-layout
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /private/var/folders/26/7wgn78s12bx0wgk4mqn27r640000gn/T/apm-install-dir-118012-31694-184pxze.ab5qj8aor/npm-debug.log
npm ERR! code 1

となり、node.jpとnpmが必要みたいなので

買いたてのMacにNode.jsとnpmをインストール - Qiitaのサイトをみながらインストールするとatom-keyboard-macrosもインストールできた。

 

このマクロ、

ctrl-x ( start recording

ctrl-x ) stop recording

ctrl-x e execute macro

ctrl-x ctrl-e execute macro N times

ctrl-x b execute macro to the end of file

ctrl-x ctrl-b execute macro from the beginning to the end of file

 

のようにマクロを実行する回数が決められたりファイルの終わりまでマクロを実行するとかできて便利そう。

 

2017年ベスト映画

2017年に観た映画で一番よかったのは「チアダン」です。タイトルからは男子のチアリーダー映画かと思いましたが広瀬すずさんが好演する青春映画でした。天海祐希さんの演技もすごかった。