語学学習のスペースアルク(SPACE ALC)がお届けする進化するオンライン英和・和英辞書『英辞郎 on the WEB』。大学生やビジネスパースンから翻訳家、医療・製薬業関係者の方々まで幅広くお使いいただいております。
ALC Online Shop

英辞郎データ提供元 EDP のサイトへ
検索文字列 検索パス 該当件数 : 8
* データの転載は禁じられています。  
  • 検索パス
    • file search path《コ》
    • search path《コ》
  • Pythonの組み込み例外の一つに ImportError があり、これはモジュールをインポートしようとして失敗したときに発生する。これはさまざまな理由で起き得るが、最も単純なケースは、インポートしようとしたモジュールがimport検索パスの中に見つからない場合だ。これを使えば、プログラムにオプション機能を追加できる。例えば、chardetライブラリは文字コードの自動判定を行う機能を備えている。あなたのプログラムは、このライブラリがもし存在すればこれを使いたいが、ユーザがこれをインストールしていない場合でもそのまま実行を続けたいかもしれない。このような処理は try...except ブロックを使えば実現できる。
    One of Python's built-in exceptions is ImportError, which is raised when you try to import a module and fail. This can happen for a variety of reasons, but the simplest case is when the module doesn't exist in your import search path. You can use this to include optional features in your program. For example, the chardet library provides character encoding auto-detection. Perhaps your program wants to use this library if it exists, but continue gracefully if the user hasn't installed it. You can do this with a try..except block.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • Shell profile updaterは、このバージョンのPythonがシェルの検索パスにあることを保証するために、シェルプロファイルを更新するかどうかを管理する。恐らくこれを変更する必要はない。
    Shell profile updater controls whether to update your shell profile (used in Terminal.app) to ensure that this version of Python is on the search path of your shell. You probably don't need to change this.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • sys.path.insert(0, new_path)を使用して、新しいディレクトリをsys.pathリストの先頭に追加した。これで、このディレクトリがPythonの検索パスの一番初めに来ることになる。ほとんどの場合はこれで用が済んでしまうだろう。万が一、名前の衝突が起きたとしても(例えば、あるライブラリのバージョン2がPythonに搭載されているが、あなたはバージョン3を使いたいという場合)、こうすれば確実にお望みのモジュールが発見され、Python付属のモジュールの代わりに使われることになる。
    By using sys.path.insert(0, new_path), you inserted a new directory as the first item of the sys.path list, and therefore at the beginning of Python's search path. This is almost always what you want. In case of naming conflicts (for example, if Python ships with version 2 of a particular library but you want to use version 3), this ensures that your modules will be found and used instead of the modules that came with Python.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • sys.pathにディレクトリ名を追加することによって、実行時に新たなディレクトリをPythonの検索パスに追加できる。これによって、Pythonはモジュールをインポートするときに、そのディレクトリも参照するようになる。この効果はPythonの実行が終了するまで続く。
    You can add a new directory to Python's search path at runtime by adding the directory name to sys.path, and then Python will look in that directory as well, whenever you try to import a module. The effect lasts as long as Python is running.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • もし、現在の作業ディレクトリ (current working directory) について知らないのなら、ステップ1は恐らくImportErrorを出して失敗するだろう。なぜかって? なぜならPythonは、Import検索パスの中からexampleモジュールを探し出そうとするが、examplesフォルダは検索パスのどこにもないので見つけ出すことができないからだ。この問題を解決するには、次の二つのうちのどちらか一つを行えばいい:
    If you don't know about the current working directory, step 1 will probably fail with an ImportError. Why? Because Python will look for the example module in the import search path, but it won't find it because the examples folder isn't one of the directories in the search path. To get past this, you can do one of two things:〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • コマンド検索パス
    command search path《コ》
  • 先へ進む前に、ライブラリの検索パスについて簡単に触れておきたい。モジュールをインポートしようとすると、Pythonは何カ所かを参照する。具体的に言うと、Pythonはsys.pathに定められたすべてのディレクトリの中を見る。sys.pathは単なるリストなので、標準的なリストのメソッドを使って、簡単にそれを見たり、内容を変更したりできる(リストについてはネイティブデータ型で詳しく学ぶ)。
    Before this goes any further, I want to briefly mention the library search path. Python looks in several places when you try to import a module. Specifically, it looks in all the directories defined in sys.path. This is just a list, and you can easily view it or modify it with standard list methods. (You'll learn more about lists in Native Datatypes.)〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0