Environmental path to Python not working? - python

I have Installed Python 3.4 onto a new PC. Python works but I am trying to get pip to work on this. I have made a path for Python which is below.
C:\Python34\python.exe
When i run the below code
C:\Windows\System32>pip install python-docx
'python' is not recognized as an internal or external command,
operable program or batch file.

It seems that you haven't configured your PATH variable correctly. In order to do so:
Hold down the Win key and press Pause.
Click Advanced System Settings.
Click Environment Variables.
Append ;C:\Python34 to the PATH variable.
Restart Command Prompt.
(You may also just run set PYTHONPATH=%PYTHONPATH%;C:\Python34 in the cmd)
Further information is available in The Official Python Installation Guide for Windows.

Related

Python was not found error when runnig code

After a few routine windows updates, I started getting this error when I was running python code in VSCode.
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
I got told to first check PATH and to untoggle Python in App Execution Aliasies. I figured that python was already added to the PATH (I had just checked the box when downloading) and that when I untoggle Python in App Execution Aliasies I get another error
'python3' is not recognized as an internal or external command, operable program or batch file.
So I'm essentially stuck between two different errors and a correct PATH and the only times when I can run a code is when I run it from the default Python IDE that comes in the download package.
Anyone know how to fix this?
PS. when I download Python from Windows Store, it works but I don't know how to use pip with it to install external packages.
Below is the pic of my PATH.
Please reinstall python. When you install python, there will be a prompt in the lower left corner to automatically add it to the environment variable. Please check it.
At the same time, please select the correct Python interpreter in vscode.
You can refer to docs for more information.

command line not recognizing python despite it being on my computer

I tried the answer to when this was asked previously and it didn't work, so I'm asking here.
I'm very new to both windows and python, and am trying to run python from my (Windows 10) command line so that I can use pip to install a package (SpaCy). I'm not entirely sure what I'm doing wrong, but after the
C:Users\myname>
typing
C:Users\myname>python
leads to an invalid syntax error, saying:
'python' is not recognized as an internal or external command,
operable program or batch file.
I have python 2.7 installed on my computer, and it works when I use an interpreter such as Rodeo.
I also get the same error when trying to use pip to install SpaCy, although when I try to install pip I get a message that pip is already installed.
Is there some basic knowledge I'm just missing?
When you installed Python, there would have been a tick box that wanted to know if you would like the Python Path adding to the Environment variables. As you didn't select this, your Windows Path doesn't include the folder where the Python executable lives.
To fix this, rerun the installer and modify your install, it should pop up the screen with the tick boxes on, select the one mentioned above and the job should be done.
This is how it works with the Python3 installer, anyhow and I assume that 2.7 will use the same basic model.
You may need to add the newly installed location of python to your path variable.
Control Panel > System > Advanced system settings > Environment variables
Find "Path" and edit.
Append a semicolon ';' and add the full path to your python install location.
To try your new path, you may need to start up another command line cmd.exe to pick up the new PATH.
You need to add python.exe to your Path:
Locate where Python is installed. It's usually located at:
C:\Users\<username>\AppData\Local\Programs\Python\<version>
Now you need to add this directory to your path. To do that press Windows Key, search for 'Environment Variables' and click on 'Edit the System Environment Variables'.
Then 'Environment Variables...'
Click on 'Path' variable and hit 'Edit...'
Then, 'New'...
Put the directory where your Python.exe is installed and hit okay,
Restart your command prompt and try again.
You need to add python installation path to your environment variable.
Click search icon on windows task bar--> type "environment variable" Edit environment variable will pop (System or User)--> add path to python installation till bin to "Path" variable.

Successfully Installed Python 3.1.2 but When Using the Command to check if its installed on my PC, it doesn't recognized the set of commands

I have already installed Python 3.1.2 on my window 7(64bit) .However when I checked if its successfully installed using this command : python --versionI still got an error as "python" is not recognized..". Then I using the command setx PATH "C:\Python 31", error message shown setx is not recognized.."
I have checked that Python 31 was shown under my C drive and i have already open the PYTHON GUI window
Please i need help on where i get this wrong
I guess that you mean that you want to try and use it to see if it works and recognized from the command line.
Verify that your python bin folder is in your system path. You can follow this guide from msdn, or any other guide to add the python bin folder to the path environment variable.
The path you'll want to add is where python.exe is located, probably at C:\Python31\bin" or similar.

Trying to access Python through Windows Command Prompt without adding Environment Variable

I am trying to access Python through a Windows command prompt, but am at an office and cannot add an Environment Variable. So, I cant follow the advice provided here. Thus, I added a User Environment Variable through User Accounts and use Variable:python and Value: C:\Python33. When I do a Windows Run check on %python% I reach the required Python33 folder. However, when I type python -Version in the command prompt I get the error 'python' is not recognized as an internal or external command, operable program or batch file. I am not sure how to proceed.
Run Python from the command prompt and include the full path to python.exe. For example to get the version:
C:\Python33\python.exe --version
When you run a script you specify the path to the script if you're not in the directory where the script is located. For example, if your script is in C:\scripts and is called my_script.py:
C:\Python33\python.exe C:\scripts\my_script.py
Instead of setting environment variables, you can use the whole path, like Neo wrote e.g.:
C:\Python33\python.exe yourPythonScript.py
Remove any environment variables you have added.
C:\Python33\python.exe pyscript.py should work.
I once Had a similar problem, but i couldnt find any solution, not even adding the path to the python folder was working.
Then I opened Python and clicked in File, then browser path, and I found that I had another folder that contained the real Python folder, not the default one. Maybe it could work for you too.

Windows 7 and python 2.7

I want to install python 2.7 to my computer, but I have a problem. I've already installed that .msi file from the python official website and now I have a folder C:\Python27 . I've set up environmental variables(system variables) like this: ....;C:\Python27;C:\Python27\Tools\Scripts After I've restarted my computer I type to the command window 'python' but It sais:
'python' is not recognized as an internal or external command, operable program or batch file.
Checkout this link
Python is not added to the DOS path by default. This screencast
will walk you through the steps to add the correct entry to the System
Path, allowing Python to be executed from the command-line by all
users.
To add Python to system variables: (Computer > Advanced System Settings > Environment Variables) You would goto your cmd instance, and put in PATH = C:/Python27/

Categories

Resources