[pip] pip not working in Python Installation in Windows 10

I downloaded and installed Python 3.5 from https://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.

This question is related to pip windows-10 python-3.5

The answer is


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.


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".


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.


You should use python and pip in terminal or powershell terminal not in IDLE.

Examples:

pip install psycopg2

or

python -m pip install psycop2

Remember about add python to Windows PATH. I paste examples for Win7. I believe in Win10 this is similar.

Adding Python Path on Windows 7

python 2.7: cannot pip on windows "bash: pip: command not found"

Good luck:)


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...

enter image description here


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...


open command prompt

python pip install <package-name> 

This should complete the process


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.


Examples related to pip

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip "E: Unable to locate package python-pip" on Ubuntu 18.04 How to Install pip for python 3.7 on Ubuntu 18? What is the meaning of "Failed building wheel for X" in pip install? Could not install packages due to an EnvironmentError: [Errno 13] How do I install Python packages in Google's Colab? Conda version pip install -r requirements.txt --target ./lib pip: no module named _internal AttributeError: Module Pip has no attribute 'main' Error after upgrading pip: cannot import name 'main'

Examples related to windows-10

Starting ssh-agent on Windows 10 fails: "unable to start ssh-agent service, error :1058" How to install OpenSSL in windows 10? Anaconda Installed but Cannot Launch Navigator Conda command is not recognized on Windows 10 Copy Files from Windows to the Ubuntu Subsystem Hyper-V: Create shared folder between host and guest with internal network Why Local Users and Groups is missing in Computer Management on Windows 10 Home? VMware Workstation and Device/Credential Guard are not compatible pip not working in Python Installation in Windows 10 Copy Paste in Bash on Ubuntu on Windows

Examples related to python-3.5

ImportError: No module named 'django.core.urlresolvers' 'python3' is not recognized as an internal or external command, operable program or batch file pip not working in Python Installation in Windows 10 installing cPickle with python 3.5 Difference between numpy dot() and Python 3.5+ matrix multiplication @ How to specify multiple return types using type-hints What are type hints in Python 3.5?