Error in cmd as python version not showing - cmd

While i write
python --version
I get nothing as a result in command prompt. I should get the version details of python, correct? how to rectify it?
Its the same for pip also, which file to download and how to install them, .whl or .grz? The guide shows method using pip --version which again is not working in cmd at the first place.

You did not say how your issue was solved, so I had to figure it out myself.
My problem was a 0kb Python.exe in the WindowsApps folder, which is in the PATH environmental variable. I just deleted that file, and everything worked.

I found entering python --version in terminal didn't work either, but entering py --version did.

Had the same problem. I fixed the problem by adding the python.exe directory to environment variables
Open System Properties (Right click Computer in the start menu, or use the keyboard shortcut Win+Pause)
Click Advanced system settings in the sidebar.
Click Environment Variables...
Select PATH in the System variables section
Click Edit
Add Python's path to the end of the list (the paths are separated by semicolons). For example:
C:\Windows;C:\Windows\System32;C:\Python27

Related

Windows Script Host Error: Invalid character - Code:800A03F6 - Source: Microsoft JScript compilation error

I'm having an issue with Powershell and CMD. When I try to execute Angular CLI commands in CMD like ng --version or ng new projectName, I get this error;
Windows Script Host Error: Invalid character
Code: 800A03F6
Source: Microsoft JScript compilation error
Update:
On Windows .js files are associated to Windows Scripting Host by default, so the script will not be run with Node.
Open a file explorer and find a JavaScript file, open the JavaScript file's properties and then "open with", select the Node.js program file to open that kind of files.
The error should stop after doing this.
This is how I solved it: (on windows 10)
Go to C:\Users\<your_username>\AppData\Roaming\npm\node_modules\#angular\cli\bin
Check for ng.js
Right click on ng.js file and click on "properties" option
You need to open it with node.exe so click on "Change" button go to node js installed directory and
(example: C:\Program Files\nodejs\node.exe)
Select node.exe
Click on OK
It should change the color of ng.js like below:
Now try ng -v and other ng commands
Installing this exact Angular version:
npm -g install #angular/cli#10.3.1
instead of the latest version:
npm -g install #angular/cli
fixed the above error.
I ran into this exact issue after updating to Angular CLI 13. Tried tons of different suggestions from other threads. What is described in the solutions here is essentially what worked for me, but I just want to point out a possible alternative method to applying the fix that doesn't associate all JS files with node.js.
Trying to execute a script from package.json on Windows throws a JScript error
In your windows system environment variables is one variable called PATHEXT. If the value contains .JS;, remove it. Then restart your CMD windows.
make sure you have proper path variable configured as shown below
Go to your system variable settings
path variable snapshot
make sure you have all these mentioned as part of path
C:\Users<userfolder>\AppData\Roaming\npm\node_modules#angular\cli
C:\Users<userfolder>\AppData\Roaming\npm
C:\Program Files\nodejs
make sure you have all these mentioned as part of path C:\Users\AppData\Roaming\npm\node_modules#angular\cli C:\Users\AppData\Roaming\npm C:\Program Files\nodejs
in my case, before npm install -g #angular/cli, the path of my system variable was:
C:\Users\AppData\Roaming\npm\node_modules#angular\cli\bin
I remove \bin and work!!!!!
Remember to fix this for the correct User
Associating .JS files to node.exe is the way to solve this.
BUT after struggling with the same issue, I wanted to add that the file association needs to be done with the same USER that you are working with the Terminal/Shell.
So if you use the Terminal as a Admin, you must login with your Admin Account just to fix the file association.
Cheers

gfortran: error: libgfortran.spec: No such file or directory

I am attempting to install and run gfortran-8 on macOS with the following makefile. I installed it from http://hpc.sourceforge.net/ (8.3 version). I keep getting this error:
gfortran: error: libgfortran.spec: No such file or directory
I know libhfortran.spec is located in /usr/local/Cellar/gcc#8/8.4.0/lib/gcc/8/libgfortran.spec. I have added it to my etc/paths and my .bash_profile. I have also uninstalled gfortran and reinstalled it. Anyone have a clue on what I might be missing? I am attaching my makefile below.
Makefile:
https://drive.google.com/open?id=1Y_Zo2dSYI32dQpwMtdUy5rWB8avDHXor
Bellhop Macintosh Installation
Note: I know gfortran is now part of gcc but newest at version still only works with older gfotran compilers. If you have Catalina as well, don’t worry this will still work on Mojave as well as on Catalina. I had tested it.
Go to this link.
Download
Install the downloaded gfortran-8.2-Mojave.dmg, this compiler is being used by the at to create binaries for your MacOS.
Go to the path where you extracted at folder. (In Mac you don’t need windows binary, you need to compile using gfotran compiler.)
Execute the following commands in the at folder.
Once you installed. Close all the terminals.
Open new terminal. Do as follows:
In your terminal, type this:
echo $PATH
Above command give you current path in your zsh file, If you have one.
Add bellhop to your zsh file. You can use these commands in terminal:
cd
nano .zsh
Please note that there is no Bellhop in the path right now, so we are going to add that by adding the following line in the .zsh file, Copy and paste below list (change the path accordingly)
export PATH=your_local_macOS_path/at:your_local_macOS_path/at/Bellhop:$PATH$
For me, it was:
export PATH=/Users/jaypatel/Downloads/at:/Users/jaypatel/Downloads/at/Bellhop:$PATH$
Refer the screenshot below for more details.
Once you’re done, press ctrl+X and it will ask you do you want to save your file, type Y and press enter and it will save the path successfully.
And now source ~/.zsh to your terminal using this command :
source ~/.zsh
echo $PATH
This means your acoustic toolbox and bellhop.exe are in path’s now.
And now source ~/.zsh to your terminal using this command : source ~/.zsh
And Voila, Your Bellhop is successfully installed.
Reference :
You can find more details here.

compile: version "go1.9" does not match go tool version "go1.9.1"

I am getting this error when I tried to run an example helloworld code I got onlie.
compile: version "go1.9" does not match go tool version "go1.9.1"
My computer has go1.9.1. What does the error mean and how can I fix this?
If you are installing using OSX homebrew you may need to set the $GOROOT in your .bashrc, .zshrc, etc:
export GOROOT=/usr/local/opt/go/libexec
I had the same error this morning when I updated from 1.9 -> 1.9.1 though according to several post the $GOROOT shouldn't have to be set and I had not set it until today. This may be a bug?
Edit: not a bug, for more details see answer below.
This is a mismatch between the GOROOT environment variable and the default path to your go command. One or the other needs to be changed; the one that needs to be changed depends on the specific setup on your computer. You could determine this by updating your Go to the latest version using your preferred method, running either which go (on Linux/macOS/BSD) or where go (on Windows), and then checking which of the files listed has the newer timestamp.
Linux/macOS/BSD
To change the GOROOT to match the default path of your go command, run type go and strip off the /bin/go part at the end to yield the directory path containing your Go installation. Then, add it to your .bashrc or other appropriate init file like this:
export GOROOT=/path/to/go-installation
To instead change the go command path to match your GOROOT, add this to the bottom of your init file:
export PATH="${GOROOT}/bin:${PATH}"
Windows
To change the GOROOT to match the default path of your go command, run where go take the first line of output, and strip off the \bin\go.exe part at the end. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", find the "GOROOT" variable and edit to read the path you created earlier.
To instead change the go command path to match your GOROOT, first save the output of echo %GOROOT%\bin. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", and find the
find the "Path" row in the bottom pane, click New, put in the path you created earlier, and finally click Move Up until it's at the top.
All
You'll need to open up a new command prompt to see the effects.
in case you are using mac with homebrew, just run:
brew cleanup
to clean all the legacy package, this fixed my problem.
In mac OS , if you downloaded and installed go package without brew, running brew update commands will cause this problem to occur
for fix this problem you can do :
brew uninstall --ignore-dependencies go
uninstalling go from brew will fix problem
This error happens when you forgot to delete previous golang install ... just delete its directory ... so identify go install location ... on linux issue
type go
typical output is
go is hashed (/usr/local/go/bin/go)
so just remove its grandparent directory ( go install dir not just the go binary )
sudo rm -rf /usr/local/go # NOTE this is not /usr/local/go/bin/go
now just install go and you'll be fine
For M1 Mac, the following steps helped me!
Check for which go from VSCode Terminal and check from system terminal.
from vscode terminal
user#mac % which go
/usr/local/go/bin/go
from my mac terminal
user#mac % which go
/opt/homebrew/bin/go
Whichever corresponds to the GOROOT shown go env, keep it and delete the other one
user#mac % go env GOROOT
/usr/local/go
in this case
rm -rf /opt/homebrew/bin/go
close and reload the vscode and terminal
For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.
if you use VsCode, you just add this in setting.json.
"go.goroot": "/usr/local/Cellar/go/1.x.x/libexec",
For me, it's caused by GOROOT env, using gotip before, change to brew version.
# curret go env
cat "$(go env GOENV)"
# make sure this is correct
go env GOROOT
# unset GOROOT if setted before
go env -u GOROOT
you may also want to set a proper GOROOT to match the go version.
In my case, I had a scripts that look like this:
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
Hanging around in my .bashrc/.zshrc file from a previous installation of go / trying to use gvm.
Removing this and restarting terminal solved it for me.
I had the same issue when I used getgo to update my Go version from 1.19 to 1.20. In my case, getgo created a .bash_profile and set its own export path w/c is not consistent with what's in my .bashrc.
#my .bash_profile;
export PATH=$PATH:/home/user/.go/bin
export PATH=$PATH:/home/user/go/bin
#my .bashrc;
export GOROOT=/usr/local/go/
export GOPATH=$HOME/go
export PATH=$PATH:$/home/user/go/bin:$GOROOT/bin:$PATH
SOLUTION:
I just replaced my export PATH in bashrc w/
export PATH=$PATH:$/home/user/.go/bin:$GOROOT/bin:$PATH
<Note the '.go' change w/c is now consistent to what's in my .bash_profile>.
So whether source is ~/.bashrc or ~/.bash_profile, it will always point to the same path for Go. Hope this helps. I'm also new to Go and Ubuntu. I know how painful it is to get these variables right on your own.
Took a simple approach(Linux), I had different versions of Go installed in my system.
$ whereis go
helped me to find the available go runnables, removed all, installed a fresh one and ensured to create a link for this new Go runnable in one of the $PATH folder to ensure below gives the correct version of what installed now.
$ go version

Golang: Getting started - "go" is not recognized as an internal or external command"

Trying to get started with Go but I cant manage to set up the work environnement properly.
EDITED for future reference.
You set your 'GOROOT' wrong. Set it to C:\Go\
Include C:\Go\bin to your 'Path'
Aside from #Xeph's answer, just make sure if you recently installed Go that you use a fresh terminal/cmd window.
Run command "go env" and check the path for variable "gopath" that's where you should keep your project. Else where if you run go command you will get error "go is not recognized as internal or external command"
here's what made it work for me, assuming you hadnt change anything from a fresh GO install in windows 10.
set GOROOT in user variables: C:\Go\
GOROOT User Variable screen shot
add path in user variables: %USERPROFILE%\Go\bin
Add path to User Variables screen shot
add path in system variables: C:\Go\bin
Add path to System Variables screen shot
I read various answers as well articles and most effective steps that helped me were :
My Computer -> RC -> Properties
Advanced System Settings -> Environment Variables
Under System Variables Section -> New -> GOPATH -> Project Location
Select Path -> New ->path to bin of installed go
Save and close.
Restart the cmd / system .
Run go in the cmd to check the working .
If you are not able to solve the problem even after adding environment variables, you can check if you have installed Go extension from VSCode, install it if you haven't already. Then, when you create a new GO file to work in the working directory, "gopls command not available" will be popped up,click install all to get full support inside VSCode.
I solved the issue like this, I hope that helps.

How to properly install Cabal 1.18.02 in Windows 7?

I'm trying to install the new Cabal in Windows 7. It successfully installs 1.18.02, but when I run "cabal --version" it shows 1.16. The folder C:\Users\me\AppData\Roaming\cabal\bin is at the front of my PATH.
When I directly run the 1.18 executable, I get a bunch of "cabal.exe does not exist" errors.
How can I configure Cabal to use version 1.18 by default?
There is a path conflict due the way haskell platform installs cabal.exe
As seen in this ticket
To fix it:
Delete `C:/program files(x86)/Haskell platform/lib/extralibs/bin/cabal.exe.`
In any case, you can use search tool to find which cabal.exe to delete.
I used cabal-dev to install cabal 1.18 to a sandbox, such that C:\cabal-dev\cabal-dev\bin contains the latest (1.18) cabal executable. I then set C:\Cabal-dev\cabal-dev\bin as the first Variable value in the "Path" variable in "systems variables" (as opposed to the "PATH" variable in "user variables"). That worked for me, and allowed me to keep the older build of cabal intact, (in case its needed later).
It worked for me. Good luck. Here are my exact steps:
Install cabal-dev
open command prompt anywhere
execute following command: “cabal install cabal-dev”
Install new cabal
create directory: c:\cabal-dev, cd to it
execute following command: “cabal-dev install cabal-install”
Set new, upgraded cabal path as higher priority
Close any open command prompts
run: Sysdm.cpl
Go to the “Advanced” tab
Click “Environment Variables”
Select the “Path” variable listed in the “System variables” (lower) windows
Click edit
Add following string to the beginning of the variable value:
“C:\Cabal-dev\cabal-dev\bin;”
Ok, Ok, Ok
Ensure latest cabal is being run:
Open command prompt (anywhere except c:\cabal-dev\ *)
execute following command: “cabal –V”
cabal version should be 1.18.0.2
One other possible cause of this error (aside from the cabal in extralibs problem described in another answer) is that the ld in your path can't read the .o files that GHC produces.
I hit this problem with GHC 7.8.1 RC1, and could see this going wrong by running cabal install with -v3. The 'ld' on my path was coming from Haskell Platform 2013.2.0.0.
Adding mingw\bin from the new GHC's directory to the path fixed the problem.

Resources