LoginSignup
4
3

More than 3 years have passed since last update.

advent calendar 初日

  • 準備不足で初日は、簡単なtips を書くだけです。すみません。
  • 埋まっていない日がすごくいっぱいあるので、書いていきますが、レベルはこの記事レベルのになります。すみません。

想定読者

こんな人がこの投稿の想定読者です。jupyter を、Windows で楽したいという人のための記事です。

  • ITスキルはそこそこの人
  • Windows 10 (64bit) ユーザ
  • minconda3
  • powershell(5.x or 6)
  • powershell は、jupyterで操作したい
  • PC複数使用しているが同じnotebook を使いまわししたい

省略する準備

  • jupyter のインストール

PowerShell で起動

PowerShell で、jupyter notebook で起動すると、Windows あけっぱなしにする必要あります。あまり使い勝手よくないので、閉じているといいですよね。知っている人は知っていると思いますが、起動するとすぐに閉じるコマンド紹介です。

powershell -WindowStyle Hidden jupyter notebook

notebook のパスを取得 複数PCでの使うときに便利

複数のPCで作業する場合は、絶対パスがPCによって違うことがあります。
そういった場合に、notebook の中で、notebook のいるパスが取得できれば、
スクリプトは、絶対パスを意識しないですみます。下記のコマンドで取得できます。
なお、%pwd でも取得できます。タイプ数が少ないのと、import os をしない場合でも
使えるので、適宜選択してください。

os.getcwd()

script を powershell に変更

jupyter のデフォルトの設定では、DOSプロンプトが開きます。
下記で、powershell に変更しましょう。

import os
os.environ['comspec']='powershell.exe'
!Get-Process

とてもささやかな記事ですが、役立つ人もすこしはいるかなと思っての投稿でした。

4
3
9

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
4
3