I downloaded and installed Python 3.5 from //www.python.org/downloads/ on my Windows 10 machine with IDLE
I want to install other packages using pip using the following and various other options in the IDLE commandline editor.
>> pip install packagename
>> pip --install packagename
>> pip --upgrade packagename
>> pip upgrade packagename
Where packagename I have tried various packages available from my installed Python modules Tried all the above options without any packagename a well. In short, pip doesn't work and I am stuck.
I get Syntaxerror: invalid syntax
pip is preinstalled in my Python. confirmed this with the command "import pip" and from help['modules'].
Need help on how to proceed.
System specs: Windows 10, with login as User [Local Admin privileges]. this is the only User on my computer.
asked Oct 3, 2016 at 12:55
instead of typing in "python". try using "py". for ex:
py -m pip install packagename
py -m pip --install packagename
py -m pip --upgrade packagename
py -m pip upgrade packagename
note: this should be done in the command prompt "cmd" and not in python idle. also FYI pip is installed with python 3.6 automatically.
Dmitry
6,32614 gold badges37 silver badges37 bronze badges
answered Oct 15, 2017 at 16:20
BJJ VeganBJJ Vegan
5314 silver badges3 bronze badges
1
Make sure the path to scripts folder for the python version is added to the path environment/system variable in order to use pip command directly without the whole path to pip.exe which is inside the scripts folder.
The scripts folder would be inside the python folder for the version that you are using, which by default would be inside c drive or in c:/program files or c:/program files [x86].
Then use commands as mentioned below. You may have to run cmd as administrator to perform these tasks. You can do it by
right clicking on cmd icon and selecting run as administrator
.
python -m pip install packagename
python -m pip uninstall packagename
python -m pip install --upgrade packagename
In case you have more than one version of python. You may replace python
with py -versionnumber
for example py -2
for python 2 or you may replace it with the path to the corresponding python.exe file. For example "c:\python27\python"
.
answered Mar 30, 2018 at 17:57
1
It's a really weird issue and I am posting this after wasting my 2 hours.
You installed Python and added it to PATH. You've checked it too[like 64-bit etc]. Everything should work but it is not.
what you didn't do is a
terminal/cmd restart
restart your terminal and everything would work like a charm.
I Hope, it helped/might help others.
answered Oct 26, 2019 at 21:32
I faced a problem upgrading pip from version 9.0.1 to 9.0.3 The upgrade failed middle way[after uninstalling version 9.0.1 and without installing version 9.0.3]. This usually creates a broken pip file. Broken pip can be solved by the command-->
easy_install pip
Which usually installs the latest version of pip, and solves the issue. In order to confirm, type
pip --version
Hope this was helpfull...
answered Mar 25, 2018 at 15:09
J11J11
4354 silver badges6 bronze badges
According to pip documentation
pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org
But I was surprised when I typed pip --version
in the Python Launcher and it gave me an error saying that 'pip' is not recognized. Then I tried the same in Python IDLE which gave the same error. Then I opened a cmd and typed python pip --version
and it said something like "can't open file".
Solution:
I finally realized that pip
commands are properly recognized outside of the python.exe, because pip is a separate executable. So, just open a cmd and type pip --version
and it should work as expected. If you call pip
inside a Python executable [such as the Launcher, IDLE, or calling python pip
], it assumes pip is just a variable and complains that it is not defined.
Note: I made sure that C:\Users\\AppData\Local\Programs\Python\\
and C:\Users\\AppData\Local\Programs\Python\\Scripts\
are included in
the PATH
variable.
answered May 14, 2021 at 11:01
1
open command prompt
python pip install
This should complete the process
answered Jan 20, 2017 at 13:43
Pavan NathPavan Nath
1,4941 gold badge14 silver badges23 bronze badges
1
You may have to run cmd as administrator to perform these tasks. You can do it by right clicking on cmd icon and selecting run as administrator. It's worked for me.
answered Mar 31, 2018 at 11:06
Igor OsipovIgor Osipov
1471 silver badge12 bronze badges
I had the same problem on Visual Studio Code. For various reasons several python versions are installed on my computer. I was thus able to easily solve the problem by switching python interpreter.
If like me you have several versions of python on you machine, in Visual Studio Code, you can easily change the interpreter by clicking on the bottom left corner where it says Python...
answered Sep 29, 2020 at 10:08