当我在命令行中输入 python
时,命令提示符 python is not recognized as an internal or external command, operable program, or batch file
。我应该怎么办?
注意:我的计算机上安装了 Python 2.7 和 Python 3.2。
原文由 Rohit Rayudu 发布,翻译遵循 CC BY-SA 4.0 许可协议
当我在命令行中输入 python
时,命令提示符 python is not recognized as an internal or external command, operable program, or batch file
。我应该怎么办?
注意:我的计算机上安装了 Python 2.7 和 Python 3.2。
原文由 Rohit Rayudu 发布,翻译遵循 CC BY-SA 4.0 许可协议
我已经从 Releases for Windows 安装了最新的适用于 Win10 的 Python。只需在 py
Command Prompt Window
启动 Python。
Microsoft Windows [Version 10.0.15048]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\sg7>py
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>`enter code here`
测试:
>>> print("hello!")
hello!
>>>
请注意,在我的例子中,Python 安装在 C:\Users\sg7\AppData\Local\Programs\Python\Python36>
目录中
C:\Users\sg7\AppData\Local\Programs\Python\Python36>dir
Volume in drive C is Windows7_OS
Volume Serial Number is 1226-12D1
Directory of C:\Users\sg7\AppData\Local\Programs\Python\Python36
08/05/2018 07:38 AM <DIR> .
08/05/2018 07:38 AM <DIR> ..
12/18/2017 09:12 AM <DIR> DLLs
12/18/2017 09:12 AM <DIR> Doc
12/18/2017 09:12 AM <DIR> include
12/18/2017 09:12 AM <DIR> Lib
12/18/2017 09:12 AM <DIR> libs
10/03/2017 07:17 PM 30,334 LICENSE.txt
10/03/2017 07:17 PM 362,094 NEWS.txt
10/03/2017 07:15 PM 100,504 python.exe
10/03/2017 07:12 PM 58,520 python3.dll
10/03/2017 07:12 PM 3,610,776 python36.dll
10/03/2017 07:15 PM 98,968 pythonw.exe
08/05/2018 07:38 AM 196,096 Removescons.exe
08/05/2018 07:38 AM 26,563 scons-wininst.log
08/05/2018 07:38 AM <DIR> Scripts
12/18/2017 09:12 AM <DIR> tcl
12/18/2017 09:12 AM <DIR> Tools
06/09/2016 11:53 PM 87,888 vcruntime140.dll
9 File(s) 4,571,743 bytes
10 Dir(s) 20,228,898,816 bytes free
当我在 C:\Users\sg7>
目录级别 python
可以通过键入 AppData\Local\Programs\Python\Python36\python
调用
C:\Users\samg>AppData\Local\Programs\Python\Python36\python
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
较新的 Python 3.7 将安装在: C:\Users\YourUserNameHere\AppData\Local\Programs\Python\Python37
如果你愿意,你可以添加到你的路径环境变量: %USERPROFILE%\AppData\Local\Programs\Python\Python36
原文由 sg7 发布,翻译遵循 CC BY-SA 4.0 许可协议
4 回答4.4k 阅读✓ 已解决
4 回答3.8k 阅读✓ 已解决
1 回答3k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
1 回答4.5k 阅读✓ 已解决
1 回答3.8k 阅读✓ 已解决
1 回答2.8k 阅读✓ 已解决
终于成功了!!!
我需要做一些事情才能让它工作
我必须将它们添加到两者中才能正常工作。
如果我添加了任何子目录,由于某种原因它不起作用。
谢谢大家的回复。