New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys.path.append(os.pardir)がうまく行かず、os.pardirのところにフルパスを指定したところ動きました #25

Open
hidehiro98 opened this Issue Nov 30, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@hidehiro98
Copy link

hidehiro98 commented Nov 30, 2017

sys.path.append(os.pardir) だと、下記のエラーが出ました。

Traceback (most recent call last):
  File "ch05/gradient_check.py", line 5, in <module>
    from dataset.mnist import load_mnist
ModuleNotFoundError: No module named 'dataset'

os.pardir のところをフルパス (e.g. Users/user_name/deep-learning-from-scratch)にしたところ動きました。

環境は

  • macOS High Sierra
  • Python 3.6.2
  • anaconda 1.6.5
    です。

@hidehiro98 hidehiro98 changed the title sys.path.append(os.pardir)t[ sys.path.append(os.pardir)がうまく行かず、os.pardirのところにフルパスを指定したところ動きました Nov 30, 2017

@th3m1s

This comment has been minimized.

Copy link

th3m1s commented Aug 10, 2018

import os
import sys
sys.path.append(os.path.abspath('..'))

とすれば,自動的にフルパスで展開してくれます.

私の手元の環境は,

  • Ubuntu 16.04

  • Python 3.5.2
    です.

@Staircing

This comment has been minimized.

Copy link

Staircing commented Nov 17, 2018

from dataset.mnist import load_mnist
ImportError: No module named 'dataset.mnist'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment