Skip to content
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

Closed
hidehiro98 opened this issue Nov 30, 2017 · 2 comments

Comments

@hidehiro98
Copy link

@hidehiro98 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
Copy link

@th3m1s th3m1s commented Aug 10, 2018

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

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

私の手元の環境は,

  • Ubuntu 16.04

  • Python 3.5.2
    です.

@Staircing
Copy link

@Staircing Staircing commented Nov 17, 2018

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

@koki0702 koki0702 closed this Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants