inflearn logo
강의

Course

Instructor

Automating Marketing with Python

Review variables, functions, and modules

requests 모듈이 없다고 오류가 발생합니다.

2757

matinblake

5 asked

0

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

새로운 기능 및 개선 사항에 대 한 최신 PowerShell을 설치 하세요! https://aka.ms/PSWindows

PS C:\Users\spear\PycharmProjects\test> pip install requests
Requirement already satisfied: requests in c:\program files\python310\lib\site-packages (2.28.1)
Requirement already satisfied: idna<4,>=2.5 in c:\program files\python310\lib\site-packages (from requests) (3.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\program files\python310\lib\site-packages (from requests) (1.26.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\program files\python310\lib\site-packages (from requests) (2022.6.15)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\program files\python310\lib\site-packages (from requests) (2.1.0)
PS C:\Users\spear\PycharmProjects\test> 

 

위와 같이 pip install requests를 설치하고, 아래와 같이 예시 코드를 따라했습니다.

 

import requests

import json

response = requests.get('https://www.naver.com')
print(response.text)

실행을 하면 아래와 같이 오류가 발생합니다.

C:\Users\spear\anaconda3\envs\test\python.exe C:/Users/spear/PycharmProjects/test/main.py
Traceback (most recent call last):
  File "C:\Users\spear\PycharmProjects\test\main.py", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

종료 코드 1(으)로 완료된 프로세스

 

프로그램을 종료 후 다시 시작해도 동일하게 오류가 발생하는데, 원인과 해결방법을 알려주시면 감사하겠습니다.

selenium python

Answer 2

1

starcoding

안녕하세요. 아나콘다3를 사용하여 패키지를 설치하셔야 합니다.

 

https://velog.io/@nawnoes/conda-install-%EC%95%88%EB%90%A0-%EB%95%8C-Anaconda%EC%97%90%EC%84%9C-pip-install-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0

 

프롬프트창도 cmd가 아니라 anaconda propmt가 따로 있습니다. 시작메뉴에서 찾아보시거나 검색하시면 있습니다.

 

아나콘다 창에서 activate test로 가상환경 변경후에 pip를 설치하시면 되실 겁니다.

 

더 궁금하신 사항은 질문주세요.

0

awdlij09

active test 변경을 어떻게 하나요ㅠ

 

pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+ pip install json

+ ~~~

    + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

 

 

이렇게 뜨는데 어떻게 해야할지 모르겠어요ㅠ

0

starcoding

아나콘다 prompt창(윈도우10이상 검색에서 'anaconda'라고 치시면 anaconda prompt가 나옵니다)에서,

 

activate 프로젝트명

 

명령어로, 가상환경을 설정할 수 있습니다.

 

프로젝트 시작시에 만드셨던 이름으로 하시면 됩니다. 본 강의에서는 test로 하였기에 위와 같이 한 것입니다.

 

더 궁금하신 사항은 질문주세요.

[작업형 3] 6~7. 카이제곱 검정

0

2

1

시스템 아키텍처를 강의에 나온 것 처럼 그리고 싶은데 공유 가능할까요?

0

3

1

9회 작업형3 문제 1-1

0

6

2

최종답안 계산 방식 질문

0

7

1

PROJECT_STRUCTURE.md 파일 공유좀 해주세요

0

6

1

맥북에서 아이패드로 연결해서 보려고 하면 화면이 안뜹니다.

0

2

1

시험 치기 전 급하게 질문 사항

0

15

2

노션 사용권한 불편합니다.

0

9

2

유형3

0

16

2

작업형 2 연습문제 섹션 3

0

12

2

dags_email_on_failure

0

6

1

11 기출문제 ipynb파일

0

16

2

작업형 3 유형

0

17

2

session이 점점 길어지면 어떻게 대처하나요?

0

13

1

11회 기출 유형(작업형1) 2번 정답

0

17

2

f1 score 질문

0

16

2

10회 작업형 2 인코딩 질의

0

11

2

시간이 넘 지나서 구매했더니 현재 변경된 환경에서 어려움이 있네요.

0

56

1

프로젝트 생성 오류

0

74

1

크롬이 자동으로 닫힙니다 _ 23년 4월

0

671

1

크롬이 자동으로 닫힙니다.

0

1175

1

이미 이웃이거나 서로이웃일 경우 에러발생

0

340

1

크롬이 켜졌다가 로그인화면만 보여주고 자동으로 꺼집니다.

0

430

1

소스코드는 어디에서 다운로드하나요?

0

514

1