I was trying to download a GUI, but the terminal kept giving me this error:
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
I'm trying to install it using this command:
python -m pip install --upgrade pip setuptools virtualenv
Check your Python version and be sure it is installed on your machine
Check the path environment variable
Go to -> "start" and type "Manage App Execution Aliases". Go to it and turn off "Python"
I was having the same issue and I fixed it by using the below method.
Copy two paths of Python
C:\Users\Maninder\AppData\Local\Programs\Python\Python39
C:\Users\Maninder\AppData\Local\Programs\Python\Python39\Scripts
These are the paths where your Python interpreter is installed. Now add this path into your environmental
variable. Put this path into System variable, not in user variable. I was using user variable, so I was facing the issue.
I have a solution for you. Make sure you check the path mark during installation. Then you need to go to Manage App Execution Aliases.
Simply go to your search bar and search for Manage App Execution Aliases. You will find the attached screen and you need to turn off App Installers as you see on the screen. Also, see the path,,, follow Maninder's answer.
Then you are good to go! :)
I had the same issue. In Windows CMD, only: py --version, works.
I tried adding the path on System variables, and it didn't work. If you are using PyCharm as I do, try to run all commands from the IDE's terminal. It usually is on the side bar where the Run and the Console is. If it is not, go to: menu View → Tool Windows → Terminal. It worked just fine for me.
You need to download Python from https://python.org. When in the installation, be sure to check the option that adds Python to PATH.
I haven't gotten this error before and have been using Python a long time, and then suddenly it showed up. I think that it is a result of a Windows update designed to steer you to their store.
In any case: to remedy the problem, go to Settings → app execution aliases → and turn "off" Python. (What they tell you to do, in other words). This should resolve the problem.
If you have installed Python successfully with add python path, ticked on, and have added
C:\Users\<user>\AppData\Local\Programs\Python\Python39
C:\Users\<user>\AppData\Local\Programs\Python\Python39\Scripts
to the path into System variables and have turned off the "aliases" and they all didn't work, you can simply use python instead of python3 in your cmd command.
Check the Aliases for App Execution in Windows. Search for Alias App in your Windows toolbar to find the UI for this. Try turning off anything Python related.
Try adding the following to your "Path" environment variable:
C:\Users\Default\AppData\Local\Programs\Python\Python37
C:\Users\Default\AppData\Local\Programs\Python\Python37\Scripts
Replace Python37 with your own version.
I solved this problem for Visual Studio Code with just writing "python" in the console:
python
After that, Microsoft Store opens automatically with the Python app:
And I just click Get.
And it all work!
All the previous answers are correct, but in my case, I was getting this, because I was not passing the version...
The fix is passing the version:
py.exe -3 your_program
If you're on Windows, you may want to use the Python installer, in Windows Marketplace.
I faced the same error while using Anaconda and trying to link the Python executable path in the command prompt.
It got rectified by going to Settings → App execution aliases → and turning "off" Python. Then again I had to set the path for Python in Anaconda and was successful in executing "python --version" command.
The same thing happened to me even after trying all the above-mentioned steps.
I just restart my system and it was working fine. Do it and if still doesn't fix the issue then make sure you have checked "add python ( any version ) to PATH" before installing Python.
If none of the previous answers are working, you can check if you have the Python executable in your program files.
Go to C:\Program Files and check if you have the Python application. If not, go to the python download website here and download the .exe file.
While installing you must select "Custom install" and select the location as C:/Program Files.
Install it and it should work now from anywhere. This worked for me!
To sincerely resolve this issue, do the following:
Uninstall the Python instance and reinstall it. Note: Make sure you check
"Add variable PATH".
On the command line, type:
python -m pip install --upgrade pip setuptools virtualenv
I got this issue when I used Visual Studio Code as the IDE, and Anaconda as my Python compiler. And you don't need to close the "app alias" in settings, but copy your python.exe to python3.exe in your Anaconda folder.
That happened to me. So, to fix it, you have to follow the following steps:
Uninstall the Python version you already installed.
Go ahead and open the installation file to reinstall it again.
Before hitting Install Now, make sure to tick the box in front of Add Python to path.
Go ahead and complete the installation procedure as usual.
Steps for installing Python
The problem is more subtle than it seems.
For example, if you are using Visual Studio Code on the bottom left, you should see Python X.X.X xx-bit (the X is the version).
If you click in there you will see where the IDE is getting the python.exe from.
Locate that folder into your file explorer and then just follow the answer that is saying to change the environments variables.
So copy the path where python.exe is and add it to the Path variable and do the same where the Script folder is (it is in the same directory where the python.exe is).
Then of course make sure your IDE is using the right Python.
None of the answers here worked for me. I did this and the error went away.
For Windows 11 which I was using, I reran the python-3.10.5-amd64.exe file from my downloads directory and then chose to modify the installation.
Then I followed these easy steps.
Make sure the PIP component is checked before proceeding to install.
Then check 'Add Python to environment variables' if it's not checked already.
Proceed to Install.
At this point, your error will be solved
If you already have the Python executable on your machine and you are getting this error in Windows 10, search for the Python executable and copy its path then copy the path in system variables. It worked for me.
to check in windows
py --version
or restart your pc first then put htis command again
I have deleted old python versions and installed new python (version 3.5.2) and after i restarted computer I have lost system tray and icons on the desktop. I found some solutions that are based on setting up CCSM over terminal but it's not that simple as it looks like. There is no terminal and no ccsm installed anymore so i have followed one tutorial where you need to click on desktop, create new folder and try to run terminal from /usr/bin/ directory. Because there was no terminal i found xterminal and started with entering commands like DISPLAY=:0 ccsm but i got error "bad interpreter".
Anyways, i found some way to delete and reinstall python and i can see its installed in Python-3.5.0 directory. So i was thinking i start the DISPLAY command thru script and run it with python3.5 someScript.py command. That part was success but then i got error " no ccsm " which is true. So...
1.) i try to install with sudo apt-get install compizconfig-settings-manager
but i got error https://ibb.co/Jdm6BFf
2.) after googling i found some solutions for this but then i land it in the same problem:
https://ibb.co/x8LHFjy
3.) btw. i try to install "minimal" version of python and it was installed but with some errors.
It looks like that path to python is not a problem, because I run the script directly so it must be missing packages, i have no clue how to update it or what to do next...
Purging python and trying to reinstall again ?
Thank you guys for your answers !
E.
I am trying to install Python 2.7 (64 bit) on Windows 10. In the middle of the installation, a window pops up saying:
Error writing to file C:\Python27\pythonw.exe. Verify that you have
access to that directory
How can I resolve this issue and install Python?
This error is normally encountered when the installer does not have admin rights for the drive/folder you are installing to. I also noticed that you are installing to drive C:
Here are a couple of things for you to try.
Open the installer program by right-clicking, and then selecting "Run as Administrator".
Depending on how you have your PC set up you may not have permission to install on drive C:
If this is a work computer, talk to your IT department. Otherwise, seriously consider using different drives to keep your OS and your applications separated.
I encountered a similar issue while installing Python 2.7.11 on Windows 7 (64bit). Here is how I solved the error.
Note down the path mentioned in the error.
Do not close the error message. i.e. Do not press "Retry" or "Cancel", let it be there.
Go to the directory mentioned in step-1.
Try to create a new folder or text file in this directory.
You will get an error message saying "The Disc Structure is Corrupted and Unreadable". This is the real issue which is causing the Python installation to fail.
Run Command Prompt as an administrator and enter the command: Chkdsk \f C:
Either it will start checking the disc or it will ask you to select if you want to check disc next time you boot-up your machine. Select Yes and restart your machine.
A disc check will be performed, which may take 5-10 minutes.
Now you can install Python without any issue.
I had the same problem , this is how I solved the error :
click on cancel
go to c:\
create a new folder and call it python or python3
run the python install as administrator and choose the new folder that you just created
as directory where it should be installed
et voila !
Your Windows 10 version may not be activated. So many administrator features are locked in inactivated Windows10 version.
So try to open CMD in administrator mode and run following command to ignore the activation message.
slmgr -rearm
Now you can install fresh version of python with pythonw.exe features.
Right Click The running Uninstaller. Then Right Click Python 3.9.1 64-bit as shown below in the picture. ( I have Python 3.9.1. You can do it in any Uninstaller) Now it will repair without any errors. ^_^
music = pygame.mixer.music.load('not.mp3')
pygame.mixer.music.play(loops=-1)
when executing the code I got this error:
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\Escape it!.py", line 15, in <module>
music = pygame.mixer.music.load('not.mp3')
pygame.error: Failed loading libmpg123.dll: Attempt to access invalid address.
I have tried everything from giving full path to only the name but everytime this shows up
Just close whatever IDE you are using and restart the system. It worked for me!
Restart your IDE if that doesn't work try restarting your PC it worked for me!!
Doing following steps maybe solve the problem:
Step 1: Go to browser and search download libmpg123.dll.
Step 2: download libmpg123.dll and Extract it.
Step 3: After Extract (cut or copy) the two docs and paste in "C:\Windows\System32".
Step 4: Installation successfully done.
And this is also works :-
music = pygame.mixer.music.load('not.mp3')
pygame.mixer.music.play(loops=-1)
Thanks You
All the options given above didn't work for me. So, i uninstalled and reinstalled the "pygame" library from this site. https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame. which worked well.
When you newly install the pygame, it require system restart.
Just Restart your PC/Laptop
and then Run the code, it will not throw any error.
The answer of #jrsylvester right, but there is some questions.
Why and when you will get this type of error?
Why need to restart the pc/laptop?
Answer : When you newly installed the pygame and execute your code, then it will throw an error.
The system require a reboot to setup their file or code for working environment. so restart your PC/Laptop.
Happy Coding..!
Go to the directory where pygame is installed (you can get it by typing pip install pygame).
Look for the libmpg123.dll in pygame directory.
Copy and paste to C:/windows/system3 and C:/windows/sysWOW64.
1.Go to the directory where pygame is installed (you can get it by typing pip install pygame).
2.Look for the libmpg123.dll in pygame directory.
3.Copy and paste to C:/windows/system3 and C:/windows/sysWOW64.
I got this error message because I used the version of Python that was installed from the Windows Store. I reinstalled from official Python and the error went away.
Had the same issue. Surely enough just restarting my IDE or computer didn't help as well as copypasting libmpg123.dll to Windows directories or simply reinstalling pip/pygame.
I was using Python 3.9 from Microsoft Store. Before giving up and reinstalling Python from Python.org, I downloaded pygame‑2.1.2‑cp39‑cp39‑win_amd64.whl and then run:
pip install pygame-2.1.2-pp38-pypy38_pp73-win_amd64.whl
This worked perfectly well for me without python reinstallation.
I was under the same problem what i did was simply Install another IDE or just try reinstalling pygame.
I have installed python 2.7.11 from this link and then restarted my system. However when I go to cmd and run python --version. It gives me an error that
python not recognized as an internal or external command.
So I try to manually add it to my Path variable I see my python being installed at C:\Python27 so I add someotherpath;C:\Python27 to path variable and reopened windows cmd. But it still gives me the same error.
Is there some other way to get over with this problem.
Thanks
Please run the following command in the command prompt.
echo %PATH%
It should have whatever path you have set manually. Otherwise Open a new Command prompt and try the same command.
Run python
If it is not working after that.
Please kindly check the Python.exe is available in C:\Python or Not ?
Changes in PATH variable do not affect already open programs. Close your command line (or powershell) window and reopen it in order to use new PATH variable.
I got same error there are two ways to solve
1)Try using py --version
2)If py is also not recognised than uninstall python and install it again but select the add to path optionas show in fig this time
Easiest way to fix this is to reinstall Python and check "Add to Path" button during the installation.
Python2.7 contains a scripts that adds location to path for windows.
So running
C:\Python27\Tools\Scripts\win_add2path.py
solved my issue