[Errno 2] No such file or directory errors when running AWS commands

0

First off, I am new to Python and AWS, but I know Windows.

When I open a command prompt and run Python, everything works fine regarding core Python commands. However, when I try to execute any AWS commands with Python I get "No such file of directory" when trying to locate AWS. See below:

C:\WINDOWS\system32>python aws configure python: can't open file 'C:\WINDOWS\system32\aws': [Errno 2] No such file or directory

I installed boto3, and the install path is: "C:\Users<User>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts"

If I change directory (CD) to "C:\Users<User>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts", then everything works fine.

How do I get Python to "include" the "C:\Users<User>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts" folder, so I can run Python from other folder?

It seems like I should NOT have to change directory to "C:\Users<User>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts" to get things working.

My OS is Windows 10.

Some of my user PATH environment variable paths are below: C:\Users<User>\AppData\Local\Programs\Python\Python311 C:\Users<User>\AppData\Local\Programs\Python\Python311\Scripts C:\Users<User>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts

Thanks,

Kent

Kent
posta un anno fa870 visualizzazioni
1 Risposta
0

Hi Kent

In the C:\WINDOWS\system32>python aws configure python its looks for the aws command within the system32 folder and since its not present in the system32 folder it gives you the file not found error.

Other than trying to install packages at a global level I would recommend that you create Python virtual environment, activate it, then install the required packages there and try out your commands. With the virtual environment activated python will look for any installed packages within the environment.

This will allow you to have an encapsulated environment with all your required packages without having to deal with Windows PATHs or anything.

Python Documentation -> https://docs.python.org/3/library/venv.html Guide to creating virtual environments -> https://www.askpython.com/python/activating-virtual-environment-in-windows-10

Hope this helps

profile picture
Bisina
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande