So I have recently installed Python Version 2.7.5 and I have made a little loop thing with it but the problem is, when I go to cmd and type python testloop.py I get the error:
‘python’ is not recognized as an internal or external command
I have tried setting the path but no avail.
Here is my path:
C:\Program Files\Python27
As you can see, this is where my Python is installed. I don’t know what else to do. Can someone help?
C:\Users\Cpsa>py
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>>
I have found the answer… click on the installer and check the box “Add python to environment variables” DO NOT uninstall the old one rather click on modify….Click on link for picture…
I have met same issue when I install Python, and it is resolved when I set a PATH in system, here are the steps.
Navigate to “Control Panel” -> “System”
Click “Advanced system settings” on the left
Click “Environment Variables”
Search and click “Path” variable
Click “Edit”
Add “C:\”to the environment variables field, if you are using Windows7, then separate it by a semicolon from the existing entry. If you are using Windows10, just simply click “New” to add.
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
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.
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.
If you uninstalled then re-installed, and running ‘python’ in CLI, make sure to open a new CMD after your installation for ‘python’ to be recognized. ‘py’ will probably be recognized with an old CLI because its not tied to any version.
Option 1 : Select on add environment var during installation
Option 2 : Go to C:\Users-> AppData (hidden file) -> Local\Programs\Python\Python38-32(depends on version installed)\Scripts
Copy path and add to env vars path.
For me this path worked : C:\Users\Username\AppData\Local\Programs\Python\Python38-32\Scripts
回答 14
将SQL Server 2019与Python一起安装后,它与Python指令更加混乱。我发现的实际路径如下:
还有其他参考SQL 2019版本的Python的文档。有一条声明建议仅从git(https://www.github.com/Microsoft/sqlmutils)上的sqlmutils-xxxzip下载中使用PIP,但有一个警告。目前,这仅适用于R,不适用于Python(Anaconda,因此为pip)。Python over SQL可以运行,但是pip尚不可用。(11/25/2019)
There is additional documentation in reference to SQL 2019’s version of Python. There is a statement that recommends PIP be used only from a download of sqlmutils-x.x.x.zip located on git (https://www.github.com/Microsoft/sqlmutils) But there is a caveat. Currently this only works for R and not for Python (Anaconda and consequently pip). Python over SQL works but pip is not yet available. (11/25/2019)