inflearn logo
강의

Course

Instructor

Automating Marketing with Python

Review variables, functions, and modules

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

2758

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로 하였기에 위와 같이 한 것입니다.

 

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

수강기간즘연장해주세요

0

3

1

작업형3 기출

0

6

1

유형2에서 데이터분할 생략 가능여부

0

7

1

9회 기출 유형3 질문

0

7

1

lgb 기초편

0

5

1

수업자료 문의

0

7

1

괄호 사용

0

8

1

작업형 2 데이터 전처리 질문

0

9

0

11회 기출 유형 작업형1 문제 3-1

0

8

0

7회 3유형 2번문제 질문

0

7

1

예시문제 작업형2 (ver2023) 질문입니다

0

10

1

Data type에 따른 처리

0

6

1

Cursor 실행 문의

1

11

2

데이터 전처리 관련

0

13

2

시험에서 문제 불러오기

0

12

2

2번문제 출력값 질문

0

17

2

pd.get_dummies()가 bool로 반환

0

16

2

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

0

56

1

프로젝트 생성 오류

0

74

1

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

0

671

1

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

0

1175

1

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

0

340

1

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

0

430

1

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

0

514

1