LoginSignup
7
6

More than 5 years have passed since last update.

sys.path.append()の話

Last updated at Posted at 2017-02-08

書籍:ゼロから作るDeepLearning(オライリー・ジャパン)内の73ページのmnistデータの読み込みで少しつまずいたが、解決したので解決方法を書いておく。

つまずいた部分


最初のmnist.pyのあるフォルダの一つ上のフォルダ内をインポートするsys.path.append(os.pardir)mnist.pyがimportできない。

解決方法


※既にgithubからリポジトリファイルをダウンロードし、解凍してあることを前提とする。
カレントディレクトリはどこでもよくて、sys.path.append(os.pardir)の部分をsys.path.append(絶対パス)にする。

例:sys.path.append(D:\File\deep-learning-from-scratch-master)

多分これでいけるはずです。

7
6
0

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
7
6