파이썬 has no attribute '__path__' 에러

2021. 7. 2. 10:16·IT기술 관련/파이썬_루비 등 언어
반응형

https://stackoverflow.com/questions/36230492/error-while-finding-spec-for-fibo-py-class-attributeerror-module-objec

python -m tt.py 

 

위와 같이 명령어 실행시 has no attribute '__path__' 에러 발생 할수 있다

python -m tt --> py를 제거하고 실행하면 된다. 

 

---

 

There are two ways you can run a Python 3 script.

  1. python fibo.py: The argument is the name of the .py file. Dots are part of the filename.
  2. python -m fibo: The argument is the name of a Python module, without .py. Dots indicate packages; fibo.py means "the module py in the package fibo."

This is a small distinction for a simple script like yours. But for something bigger or more complex, it has an important effect on the behavior of the import statement:

  1. The first form will cause import to search the directory where the .py file lives (and then search various other places including the standard library; see sys.path for a full list).
  2. The second form will make import search the current directory (and then various other places).

For this reason, under Python 3, the second form is required for most setups which involve packages (rather than just loose modules in a directory), since the parent package of the script may not be importable under the first form, which can cause things to break.

 

반응형
저작자표시 비영리

'IT기술 관련 > 파이썬_루비 등 언어' 카테고리의 다른 글

파이썬 에러 ModuleNotFoundError: No module named ‘win32api’ 해결 방법  (0) 2023.03.14
Python whl 파일 설치 방법  (0) 2019.11.13
파이썬 requests 라이브러리를 활용한 웹 취약점 점검  (0) 2017.02.02
[PYTHON 3] Tutorials 24. 웹 크롤러(like Google) 만들기 1 - How to build a web crawler  (1) 2017.02.02
[파이썬] typeError: isinstance() arg 2 must be a type or tuple of types 에러 해결  (0) 2016.09.21
'IT기술 관련/파이썬_루비 등 언어' 카테고리의 다른 글
  • 파이썬 에러 ModuleNotFoundError: No module named ‘win32api’ 해결 방법
  • Python whl 파일 설치 방법
  • 파이썬 requests 라이브러리를 활용한 웹 취약점 점검
  • [PYTHON 3] Tutorials 24. 웹 크롤러(like Google) 만들기 1 - How to build a web crawler
호레
호레
창업 / IT / 육아 / 일상 / 여행
    반응형
  • 호레
    Unique Life
    호레
  • 전체
    오늘
    어제
    • 분류 전체보기
      • 법률
        • 기본
        • 개인정보보호법
        • 정보통신망법
        • 전자금융거래법
        • 전자금융감독규정
        • 신용정보법
        • 온라인투자연계금융업법
      • 창업
        • 외식업 관련
        • 임대업 관련
        • 유통업 관련
        • 세무 관련
        • 마케팅 관련
        • 기타 지식
        • 트렌드
        • Youtube
      • IT기술 관련
        • 모바일
        • 윈도우
        • 리눅스
        • MAC OS
        • 네트워크
        • 빅데이터 관련
        • A.I 인공지능
        • 파이썬_루비 등 언어
        • 쿠버네티스
        • 기타 기술
      • 퍼블릭 클라우드 관련
        • Azure
        • GCP
        • AWS
      • 정보보안 관련
        • QRadar
        • Splunk
        • System
        • Web
      • 기타
        • 세상 모든 정보
        • 서적
      • 게임 관련
        • 유니티
      • 부동산
      • 맛집 찾기
        • 강남역
        • 양재역
        • 판교역
        • ★★★★★
        • ★★★★
        • ★★★
        • ★★
        • ★
      • 결혼_육아 생활
        • 리얼후기
        • 일상
        • 육아
        • 사랑
        • Food
      • 영어
        • 스피킹
        • 문법
        • 팝송
        • 영화
      • K-컨텐츠
        • 드라마
        • 영화
        • 예능
      • 독서
      • 프로젝트 관련 조사
        • 시스템 구축
        • 로그 관련
        • 웹
        • APT
        • 모의 해킹
        • DB
        • 허니팟
        • 수리카타
        • 알고리즘
        • FDS
      • 기업별 구내 식당 평가
        • 한국관광공사
        • KT telecop
        • KT M&S
        • KT powertel
        • KT cs 연수원
        • 진에어
      • 대학 생활
        • 위드윈연구소
        • 진로 고민
        • 채용정보
        • 자동차
        • 주식
        • 악성코드
        • 게임 보안
      • 쉐어하우스
  • 블로그 메뉴

    • 홈
    • 게임 관련
    • IT 기술 관련
    • 태그
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    복리후생
    대통령
    수제버거
    판교역
    수제버거존맛
    판교맛집
    런치
    상호관세
    수제버거맛집
    보안가이드
    유니티
    AWS
    마케팅
    점심
    판교
    돈까스
    쥬쥬랜드
    맛집
    이재곧죽습니다
    무역전쟁
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
호레
파이썬 has no attribute '__path__' 에러

개인정보

  • 티스토리 홈
  • 포럼
  • 로그인
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.