SherlockSpreadsheets
SherlockSpreadsheets

Reputation: 2370

Windows 10 - Py command works Python command fails, Atom script failure

I am getting started with Python. I have downloaded the latest version and installed on my Windows 10. I did default instead of Advanced Settings. So I had to update the PATH environment variable to include \Python39 and \Python39\scripts. I added PYTHONPATH environment variable as well.

It seems to be working fine with py command. But with python command, I receive an error. I thought I would deal with it. But I went on to try out Atom (reference vid setups), and script execution returns an error: "Python was not found;".

Does somebody know how to make Python command work? Without reinstallation would be great. The biggest issue is I need the Atom script execution to work.

I looked at other SO posts. I have added the variables but I am unable to execute from within Atom script editor.

py --version

Python 3.9.1

python --version

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

$Env:path

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\PROGRA~2\MICROS~1\Office;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Azure Data Studio\bin;C:\Users\starf\AppData\Local\Microsoft\WindowsApps;C:\Users\starf\AppData\Local\Programs\Python\Python39;C:\Users\starf\AppData\Local\Programs\Python\Python39\Scripts;C:\Program Files\Azure Data Studio\bin;C:\Users\starf\AppData\Local\atom\bin

$Env:pythonpath

C:\Users\starf\AppData\Local\Programs\Python\Python39

dir

Directory of C:\Users\starf\AppData\Local\Programs\Python

01/12/2021 11:34 AM .

01/12/2021 11:34 AM ..

01/12/2021 11:35 AM Python39

0 File(s) 0 bytes

3 Dir(s) 838,125,592,576 bytes free

'dir'

Directory of C:\Users\starf\AppData\Local\Programs\Python\Python39

01/12/2021 11:36 AM < DIR > .

01/12/2021 11:36 AM < DIR > ..

01/12/2021 11:35 AM < DIR > DLLs

01/12/2021 11:35 AM < DIR > Doc

01/12/2021 11:34 AM < DIR > include

01/12/2021 11:35 AM < DIR > Lib

01/12/2021 11:35 AM < DIR > libs

12/07/2020 06:12 PM 32,622 LICENSE.txt

12/07/2020 06:13 PM 1,036,976 NEWS.txt

12/07/2020 06:12 PM 101,432 python.exe

12/07/2020 06:12 PM 59,448 python3.dll

12/07/2020 06:12 PM 4,451,896 python39.dll

12/07/2020 06:12 PM 99,896 pythonw.exe

01/12/2021 11:36 AM < DIR > Scripts

01/12/2021 11:35 AM < DIR > tcl

01/12/2021 11:35 AM < DIR > Tools

12/07/2020 06:12 PM 94,088 vcruntime140.dll

12/07/2020 06:12 PM 36,744 vcruntime140_1.dll

8 File(s) 5,913,102 bytes

10 Dir(s) 838,351,183,872 bytes free

Youtube vid screenshot (advanced install) * I did standard *

https://www.youtube.com/watch?v=UvcQlPZ8ecA&ab_channel=ProgrammingKnowledge2

enter image description here

Atom execution error (Script package installed)

enter image description here

Upvotes: 0

Views: 479

Answers (2)

SherlockSpreadsheets
SherlockSpreadsheets

Reputation: 2370

My previous answer about Atom code editor script profile works, but it's not the best answer. My path was added in the User variables instead of the System variables. I added PYTHONPATH to system variable with 2 paths. And now the Atom code editor works great with standard profile.

I am new to Python. But the Atom editor is pretty simple to setup and use. And so far I like how you get a clean output of the results simply by pressing CTRL+SHIFT+B.

enter image description here

enter image description here

Upvotes: 0

SherlockSpreadsheets
SherlockSpreadsheets

Reputation: 2370

The issue is specific to Atom code editor. Solution is as follows. This article helped (link).

  • script is configured to use the python command to execute all Python files. You can override this by setting up a config profile, which will allow you to tell script to use the correct command (py).

  • Navigate the menus down to Packages -> Script and you will see an option to Configure Script. After that, you want to use Run with profile.

enter image description here

enter image description here

enter image description here

enter image description here

Upvotes: 0

Related Questions