enter image description here
whenever I run the code in VS-Code instead of retunring the string it says "File hello world not found"
Any idea what I'm doing wrong?
Clearly you run the python command in the terminal which does not understand python. So can use "python namefile.py" or simply "python" and then write you line code.
Related
I already installed VS CODE on my Mac and did all the settings. I put codes in it, and it responded, "/bin/sh: python: command not found."
I tried all kinds of methods, but they didn't seem to help.
Here is a screenshot of the error.
Please help me.
Probably the path of the python interpreter is misconfigured.
You can open a terminal and write the following command: $ whereis python
If this command does not return anything, it is likely that python is not installed (or undefined in the var env 'path') on your Mac.
If you have a path to an interpreter, change the interpreter path used by vscode.
Go to the settings and edit the field : "python : interpreter path" with the right one.
Good day.
I'm watching a video on YouTube that that is telling me to type cd documents and then within that file type cd python to connect python, but every time I try this it says "the system cannot find the path specified" I don't understand why it is saying this because I can see that python is in my documents folder.
If you are using Windows CMD or Powershell, use the command py instead of python.
Example: py myscript.py (or py.exe .\myscript.py also works)
if you want to run the python code which is located in your documents folder then open cmd and type "cd documents" and if your python code is in same folder then type "python 'filename'.py" pre enter to run
I started studying the book'python crash course'. I studied setting up Python3 in sublime text, but it doesn't run properly. Here is the code:
{
"cmd":["python3","-u","$file"]
}
I set this code to python3 in the build system. And I tried to run "hello python world!":
print("Hello Python world!)
I've tried selecting and running Python3 from my code in the build system, but it doesn't work.
I don't know why it doesn't work. what should I do?
Make sure you are actually calling the Python interpreter in the command line.
On Windows, Python is normally referenced as py if it was added to %PATH% during installation.
On Linux or macOS Python 3 is normally referenced as python3.
To add Python to %PATH%, run the Python installer again, click "Modify", then activate "py launcher", click "Next" and "Install".
Use on Windows:
{
"cmd":["py", "-u", "$file"]
}
Linux / macOS:
{
"cmd":["python3", "-u", "$file"]
}
PS: I don't know if your Python code just has a typo here in the question, but there seems to be missing one double quote. If you are getting error messages containing "Syntax Error", forget about the py launcher. There's just a syntax error in your code. Use:
print("Hello Python World!")
I want to script with python using Notepad ++ but it works strangely, actually it does not work, so I have pycharm an everything is going well but in notepad ++ when I save file with .py and click run it does not work is there a step by step instruction to follow?
I have same problem with sublime text editor so I am lucky with just Pycharm all of the others has confused me please help me.
Notepad++ and sublime are text-editors and not interpreters. To run python script, you need a python interpreter. If you want to use notepad++, then write the python script in notepad++, open command prompt and run the python script from command prompt.
Assuming that you have python installrd, suppose you have created a file name "example.py" in the path "C:/Users/User/Desktop", then to run the script you will have to run the following commands:
$ cd "C:/Users/User/Desktop"
$ python example.py
I have no idea Why you gave me this -1 may be someone think that he knows everything so my idle.py is not the same location to my computer and when I assign location it pops up an error
sorry for error message image it is unable to copy
Well, i wrote a simple "hello world" in julia, but i cannot figure out on how to run the code. I've tried to run by ./nameOfMyFile.jl and the terminal returned to me that I have syntax errors.
My code is just:
println("hello world")
Wich works perfectly if i run julia on the terminal and write the code after that...
The error is something like( I am translating it from portuguese):
./hello_world.jl: line 1:syntax error close to the unexpected token `"hello world"
./hello_world.jl: line 1: `println("hello world")'
I'm using vim, debian 8 and julia 0.3.2
If you want to execute it directly from the terminal you can add a shebang to the beggining of your script i.e.
#!/usr/bin/env julia
println("hello world")
and then make it executable using chmod
[user#computer]$ chmod +x hello
then it should run as expected :)
./hello
will print "hello world" to your terminal :)
Two ways I can think of to achieve what you want
Open a terminal and do either one of the following
Inside the julia relp, that is, if you run julia in the terminal by running
julia
and when you're in, do
include("nameoffile.jl")
if you simple want to run the file, in the terminal do
julia nameoffile.jl
Based on discussions on GitHub like this one it sounds like this issue is more due to the shell than to Julia. Nevertheless, I would strongly recommend upgrading to the latest version of Julia, 0.4.6. The version that you are using is quite old and lacks a lot of improvements, including ones addressing issues at least similar to what you are experiencing.