programing tip

'python'은 내부 또는 외부 명령으로 인식되지 않습니다.

itbloger 2020. 9. 15. 07:29
반응형

'python'은 내부 또는 외부 명령으로 인식되지 않습니다.


그래서 최근에 Python 버전 2.7.5를 설치했고 그것에 대해 약간의 루프를 만들었지 만 문제는 cmd로 이동 python testloop.py하여 오류가 발생한다는 것입니다.

'python'은 내부 또는 외부 명령으로 인식되지 않습니다.

경로 설정을 시도했지만 아무 소용이 없습니다.

내 경로는 다음과 같습니다.

C : \ Program Files \ Python27

보시다시피 여기에 Python이 설치되어 있습니다. 나는 다른 무엇을 해야할지 모르겠다. 누군가 도울 수 있습니까?


해당 폴더를 Windows 경로에 추가해야합니다.

https://docs.python.org/2/using/windows.html 이 질문에서 가져 왔습니다.


명령 줄에서 "python"대신 "py"를 사용해보십시오.

C : \ Users \ Cpsa> py
Python 3.4.1 (v3.4.1 : c0e311e010fc, 2014 년 5 월 18 일, 10:38:22) [MSC v.1600 32 비트 (Intel)] on win32
"help", "copyright"입력 , "크레딧"또는 "라이센스"를 참조하십시오.
>>>


대답을 찾았습니다 ... 설치 프로그램을 클릭하고 "환경 변수에 python 추가"상자를 선택하십시오. 이전 버전을 제거하지 말고 수정을 클릭하십시오 .... 사진 링크를 클릭하십시오 ...

여기에 이미지 설명 입력


첫째, 파이썬 디렉토리가 어디에 있는지 확인하십시오. 일반적으로 C:\Python27. 귀하의 것이 다른 경우 아래 명령에서 변경하십시오.

설치 한 후에도 python이 여전히 인식되지 않으면 PowerShell에 다음을 입력합니다.

[환경] :: SetEnvironmentVariable ( "Path", "$ env : Path; C : \ Python27", "User")

PowerShell을 닫은 다음 다시 시작하여 Python이 이제 실행되는지 확인합니다. 그렇지 않은 경우 다시 시작해야 할 수 있습니다.

여기에 이미지 설명 입력


명령 프롬프트에서 python -v 대신 py -v를 입력하십시오.


파이썬 버전을 보려면 py -V대신 사용해야 합니다.python -V

C : \ Users \ ghasan> py -V

파이썬 3.7.1

파이썬의 실행 환경으로 이동하려면 py대신python

C : \ 사용자 \ ghasan> py

win32의 Python 3.7.1 (v3.7.1 : 260ec2c36a, 2018 년 10 월 20 일, 14:57:15) [MSC v.1915 64 비트 (AMD64)]

자세한 내용을 보려면 "도움말", "저작권", "크레딧"또는 "라이선스"를 입력하십시오.

여기에서 파이썬 프로그램을 다음과 같이 실행할 수 있습니다.

print ( 'Hello Python')

안녕하세요 Python


관리 모드에서 CMD를 실행하여이 문제를 해결 했으므로 시도해보십시오.


Python을 설치할 때 동일한 문제가 발생했으며 시스템에서 PATH를 설정하면 해결됩니다. 단계는 다음과 같습니다.

  • "제어판"-> "시스템"으로 이동합니다.
  • 왼쪽의 "고급 시스템 설정"을 클릭하십시오.
  • "환경 변수"를 클릭하십시오.
  • "경로"변수 검색 및 클릭
  • "편집"을 클릭하십시오.
  • Windows7을 사용하는 경우 환경 변수 필드에 "C : \"를 추가 한 다음 기존 항목에서 세미콜론으로 구분합니다. Windows10을 사용하는 경우 "새로 만들기"를 클릭하여 추가하면됩니다.
  • 명령 프롬프트를 다시 열고 여기에 이미지 설명을 입력하십시오.

시스템에서이 세 파일이있는 위치를 찾은 다음 각 경로를 복사하여 환경 변수에 하나씩 붙여 넣으십시오. 그런 다음 모두 확인을 클릭하십시오.

C : \ Anaconda3

C : \ Anaconda3 \ Scripts

C : \ Anaconda3 \ Library \ bin

Then Restart your Spyder kernel(left hand side) and type python in cmd to check if it is working.


From the Python docs, set the PATH like you did as above.

You should arrange for Python’s installation directory to be added to the PATH of every command window as it starts. If you installed Python fairly recently then the command dir C:\py* will probably tell you where it is installed; the usual location is something like C:\Python27. Otherwise you will be reduced to a search of your whole disk

Use Tools ‣ Find or hit the Search button and look for “python.exe”. Supposing you discover that Python is installed in the C:\Python27 directory (the default at the time of writing), you should make sure that entering the command

Then execute the Python command using the full path name to make sure that works.


Another helpful but simple solution might be restarting your computer after doing the download if Python is in the PATH variable. This has been a mistake I usually make when downloading Python onto a new machine.


Open CMD with administrative access(Right click then run as administrator) then type the following command there:

set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib

Replace My_python_lib with the folder name of your installed python like for me it was C:\python27. Then to check if the path variable is set, type echo %PATH% you'll see your python part in the end. Hence now python is accessible. From this tutorial


I have installed python 3.7.4. First, I tried python in my command prompt. It was saying that 'Python is not recognized command......'. Then I tried 'py' command and it works.

My sample command is:

py hacker.py

제거한 후 다시 설치하고 CLI에서 'python'을 실행하는 경우 'python'이 인식되도록 설치 후 새 CMD를 열어야합니다. 'py'는 어떤 버전에도 연결되어 있지 않기 때문에 이전 CLI에서 인식 될 것입니다.

참고 URL : https://stackoverflow.com/questions/17953124/python-is-not-recognized-as-an-internal-or-external-command

반응형