0

I wanted to import the chess library into Python, and then I realized I need to use the command pip install chess but I tried that, and it didn't work.

I tried it on command prompt, the Python command prompt, and Python itself, I tried running command prompt and the Python command prompt by running with administrator rights but it still didn't work, I tried looking at videos and other websites to try and find out how to do it, and they all say pip install chess and I've tried most of the ways I could think of. When I try it on command prompt it says:

'pip' is not recognized as an internal or external command, operable program or batch file

and when I try to do it in Python it says:

SyntaxError: invalid syntax >>> pip install chess File "<stdin>", line 1 pip install chess SyntaxError: invalid syntax

I'm using Python version 3.11.

paleonix
  • 2,293
  • 1
  • 13
  • 29

1 Answers1

1

If you are using Windows, a possible solution could be to add the pip executable to your system's PATH.

  1. Search for 'Environment variables' in your windows search bar
  2. Click on 'Edit the system environment variables'
  3. Click on 'Environment Variables' on the bottom right
  4. Look for 'Path' in the top listbox and double click it
  5. Make sure your Python Scripts folder is added to the PATH variable like in my screenshot

screenshot of PATH system variable

Normally this should be done when installing Python, so if this doesn't work, go to Python's website and install the latest version to your computer. Then try running 'pip' in a command prompt to check if it was installed.

I hope this helps.

Mayfair
  • 358
  • 1
  • 11