質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

1回答

2581閲覧

IPythonでのプロファイルの作成について

sanu

総合スコア10

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

1クリップ

投稿2015/03/08 05:13

編集2022/01/12 10:55

Ipythonでプロファイル機能を使うのに1点質問があります.

「ネットに載っている通りの手順に沿ってIpythonのプロファイル機能を作成したのですが,うまくいきません.何かご存知の方がいらっしゃれば教えて頂けると助かります.」

以下2つのサイトを参考にipython_config.pyを作成しました
http://qiita.com/FmtWeisszwerg/items/78b9979cd17d4fc95a85
http://qiita.com/yuku_t/items/3c8223315b2b76524aa1

ipythonn_config.pyの変更内容

lang

1コード 2# Configuration file for ipython. 3 4c = get_config() 5 6#------------------------------------------------------------------------------ 7# InteractiveShellApp configuration 8#------------------------------------------------------------------------------ 9 10# A Mixin for applications that start InteractiveShell instances. 11# 12# Provides configurables for loading extensions and executing files as part of 13# configuring a Shell environment. 14# 15# The following methods should be called by the :meth:`initialize` method of the 16# subclass: 17# 18# - :meth:`init_path` 19# - :meth:`init_shell` (to be implemented by the subclass) 20# - :meth:`init_gui_pylab` 21# - :meth:`init_extensions` 22# - :meth:`init_code` 23 24# Execute the given command string. 25# c.InteractiveShellApp.code_to_run = '' 26 27# Run the file referenced by the PYTHONSTARTUP environment variable at IPython 28# startup. 29# c.InteractiveShellApp.exec_PYTHONSTARTUP = True 30 31# lines of code to run at IPython startup. 32# c.InteractiveShellApp.exec_lines = [] 33 34# Enable GUI event loop integration with any of ('glut', 'gtk', 'gtk3', 'none', 35# 'osx', 'pyglet', 'qt', 'qt4', 'tk', 'wx'). 36# c.InteractiveShellApp.gui = None 37 38# Pre-load matplotlib and numpy for interactive use, selecting a particular 39# matplotlib backend and loop integration. 40# c.InteractiveShellApp.pylab = None 41 42# Configure matplotlib for interactive use with the default matplotlib backend. 43# c.InteractiveShellApp.matplotlib = None 44 45# If true, IPython will populate the user namespace with numpy, pylab, etc. and 46# an ``import *`` is done from numpy and pylab, when using pylab mode. 47# 48# When False, pylab mode should not import any names into the user namespace. 49# c.InteractiveShellApp.pylab_import_all = True 50 51# A list of dotted module names of IPython extensions to load. 52# c.InteractiveShellApp.extensions = [] 53 54# Run the module as a script. 55# c.InteractiveShellApp.module_to_run = '' 56 57# Should variables loaded at startup (by startup files, exec_lines, etc.) be 58# hidden from tools like %who? 59# c.InteractiveShellApp.hide_initial_ns = True 60 61# dotted module name of an IPython extension to load. 62# c.InteractiveShellApp.extra_extension = '' 63 64# List of files to run at IPython startup. 65# c.InteractiveShellApp.exec_files = [] 66 67# A file to be run 68# c.InteractiveShellApp.file_to_run = '' 69 70#------------------------------------------------------------------------------ 71# TerminalIPythonApp configuration 72#------------------------------------------------------------------------------ 73 74# TerminalIPythonApp will inherit config from: BaseIPythonApplication, 75# Application, InteractiveShellApp 76 77# Run the file referenced by the PYTHONSTARTUP environment variable at IPython 78# startup. 79# c.TerminalIPythonApp.exec_PYTHONSTARTUP = True 80 81# Pre-load matplotlib and numpy for interactive use, selecting a particular 82# matplotlib backend and loop integration. 83# c.TerminalIPythonApp.pylab = None 84 85# Create a massive crash report when IPython encounters what may be an internal 86# error. The default is to append a short message to the usual traceback 87# c.TerminalIPythonApp.verbose_crash = False 88 89# Run the module as a script. 90# c.TerminalIPythonApp.module_to_run = '' 91 92# The date format used by logging formatters for %(asctime)s 93# c.TerminalIPythonApp.log_datefmt = '%Y-%m-%d %H:%M:%S' 94 95# Whether to overwrite existing config files when copying 96# c.TerminalIPythonApp.overwrite = False 97 98# Execute the given command string. 99# c.TerminalIPythonApp.code_to_run = '' 100 101# Set the log level by value or name. 102# c.TerminalIPythonApp.log_level = 30 103 104# lines of code to run at IPython startup. 105c.TerminalIPythonApp.exec_lines = [ 106"import pandas as pd", 107"import matplotlib.pyplot as plt", 108"import numpy as np" 109 110] 111 112# Suppress warning messages about legacy config files 113# c.TerminalIPythonApp.ignore_old_config = False 114 115# Path to an extra config file to load. 116# 117# If specified, load this config file in addition to any other IPython config. 118# c.TerminalIPythonApp.extra_config_file = u'' 119 120# Should variables loaded at startup (by startup files, exec_lines, etc.) be 121# hidden from tools like %who? 122# c.TerminalIPythonApp.hide_initial_ns = True 123 124# dotted module name of an IPython extension to load. 125# c.TerminalIPythonApp.extra_extension = '' 126 127# A file to be run 128# c.TerminalIPythonApp.file_to_run = '' 129 130# The IPython profile to use. 131# c.TerminalIPythonApp.profile = u'default' 132 133# Configure matplotlib for interactive use with the default matplotlib backend. 134# c.TerminalIPythonApp.matplotlib = None 135 136# If a command or file is given via the command-line, e.g. 'ipython foo.py', 137# start an interactive shell after executing the file or command. 138# c.TerminalIPythonApp.force_interact = False 139 140# If true, IPython will populate the user namespace with numpy, pylab, etc. and 141# an ``import *`` is done from numpy and pylab, when using pylab mode. 142# 143# When False, pylab mode should not import any names into the user namespace. 144# c.TerminalIPythonApp.pylab_import_all = True 145 146# The name of the IPython directory. This directory is used for logging 147# configuration (through profiles), history storage, etc. The default is usually 148# $HOME/.ipython. This options can also be specified through the environment 149# variable IPYTHONDIR. 150# c.TerminalIPythonApp.ipython_dir = u'' 151 152# Whether to display a banner upon starting IPython. 153# c.TerminalIPythonApp.display_banner = True 154 155# Whether to install the default config files into the profile dir. If a new 156# profile is being created, and IPython contains config files for that profile, 157# then they will be staged into the new directory. Otherwise, default config 158# files will be automatically generated. 159# c.TerminalIPythonApp.copy_config_files = False 160 161# List of files to run at IPython startup. 162c.TerminalIPythonApp.exec_files = [ 163'/Users/ホーム名/Desktop/data-analyze/settings/setting.py' 164 165] 166〜以下略〜

上記ファイル作成後,ipythonを起動してみたのですが,画面起動時の初期設定が反映されていませんでした.googleで検索しても出てこなかったので,もし何か原因がわかる方がいらっしゃいましたら教えていただけると助かります.

ちなみにバージョンはそれぞれ,Python2.7.6(64bit),Ipython2.3.1,macで開発しています.
宜しく御願い致します.

追記)
何故かわかりませんが,a=1を試しに付け加えてみたところ,

lang

1# lines of code to run at IPython startup. 2c.TerminalIPythonApp.exec_lines = [ 3"import pandas as pd", 4"import matplotlib.pyplot as plt", 5"import numpy as np", 6"a=1" 7]

a=1は正しく読み込まれ,
In [3]: a
Out[3]: 1

このように表示されました.
ますます原因がわからなくなりました.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

numpyなどのライブラリが正しくインストールされているか確認されると良いと思います.

投稿2020/03/25 20:50

dark-eater-kei

総合スコア1248

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問