0

When I type "pip install package_name", in the PyCharm terminal and execute it I receive an error:

syntaxError: invalid syntax

Could someone please clarify what I might be doing incorrectly?

Iconman
  • 25
  • 5

2 Answers2

0

pip is run from the command line, outside of Python. Most likely you are attempting to use the PyCharm python interpreter to run this command. The python interpreter only recognizes python code.

  • So how do I run pip? – Iconman Jan 21 '20 at 20:31
  • 1
    Depending on what platform you are on (Windows, OSX, etc.) open that respective command line, terminal, etc. This is where you would utilize pip. Travel to the same directory as the python project you are working with and attempt your pip install command there. If you receive a response such as "pip is not recognized as a command", you may need to add it to your path. If so, refer to this [answer](https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-command) – Malik Shalash Jan 21 '20 at 20:33
0

try to open a normal terminal, outside of pycharm, go to the same directory as the one that you're trying to install the packages and run the command.

That should solve your problem

Nícolas
  • 378
  • 2
  • 8
  • 19
  • Could the Python prompt work for this? – Iconman Jan 21 '20 at 20:33
  • no, the python prompt is a python interpreter, he will intrepret python code and this command is not a python code. you need to open a normal terminal, if you are on windows you can use CMD, power shell, and even download a different one. – Nícolas Jan 21 '20 at 20:47