Question: ~./zshrc : command not found: $


~./zshrc : command not found: $

Answers 3
Added at 2017-10-06 15:10

I'm currently going through Django tutorials on

However I'm stuck on the very first bit!

I'm told to enter the following into the command line:

$ python -c "import django; print(django.get_version())"

When I do this in the main CLI I get:

~ $ python -c "import django; print(django.get_version())"
zsh: command not found: $

When I try it in the python terminal I get:

>~ python
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>$ python -c "import django; print(django.get_version())"
  File "<stdin>", line 1
    $ python -c "import django; print(django.get_version())"
SyntaxError: invalid syntax

My research into this so far has led me to believe it could be a problem with my ./zshrc file, but this is way beyond my understanding of Macs, as a friend installed ohmyzsh for me.

When I type echo $PATH in the CLI I get:


Which just seems messy to me!

Answers to

~./zshrc : command not found: $

nr: #1 dodano: 2017-10-06 15:10

$ marks your prompt, it is not meant to be copied.

People include it with their code because it easily distinguishes that you are supposed to put in console.

For example, $ means unix shell (usually bash), # means root console, >>> means Python console.

nr: #2 dodano: 2017-10-06 15:10

As pacholik said, $ should not be included:

$ python -c "import django; print(django.get_version())"

should be:

python -c "import django; print(django.get_version())"

nr: #3 dodano: 2017-10-06 15:10

Can you try to remove the character $ and only executing python -c "import django; print(django.get_version())? The character $ usually indicates that is a bash command, but you don't need to execute it.

Also, You can open the python console and execute import django; print(django.get_version()) and get the same result.

Source Show
◀ Wstecz