pip install returning invalid syntax

后端 未结 14 1440
执笔经年
执笔经年 2020-12-15 23:24

I\'ve just installed python 3.6 which comes with pip

However, in Windows command prompt, when I do: \'pip install bs4\' it returns \'SyntaxError: invalid syntax\' un

相关标签:
14条回答
  • 2020-12-16 00:07

    try this.

    python -m  pip ...
    

    -m module-name Searches sys.path for the named module and runs the corresponding .py file as a script.

    Sometimes the OS can't find pip so python or py -m may solve the problem because it is python itself searching for pip.

    0 讨论(0)
  • 2020-12-16 00:08

    You need to be in the specific folder where pip.exe exists, then do the following steps:

    1. open cmd.exe
    2. write the following command:
        cd "The path to the python folder"
    

    or in my case, i wrote

        cd C:\Users\username\AppData\Local\Programs\Python\Python37-32\Scripts
    
    1. then write the following command
        pip install *anypackage*
    
    0 讨论(0)
  • 2020-12-16 00:10

    I use Enthought Canopy for my python, at first I used "pip install --upgrade pip", it showed a syntax error like yours, then I added a "!" in front of the pip, then it finally worked.

    0 讨论(0)
  • 2020-12-16 00:11

    Try:

    pip3 install bs4
    

    If you have python2 installed you typically have to make sure you are using the correct version of pip.

    0 讨论(0)
  • 2020-12-16 00:12

    Chances are you are in the Python interpreter. Happens sometimes if you give this (Python) command in cmd.exe just to check the version of Python and you so happen to forget to come out.

    Try this command

    exit()
    pip install xyz
    
    0 讨论(0)
  • 2020-12-16 00:13

    Try running cmd as administrator (in the menu that pops up after right-clicking) and/or entering "pip" alone and then

    0 讨论(0)
提交回复
热议问题