Error with pip install: "No moduel named pip.__main__" [duplicate] - python-3.x

This question already has answers here:
How do I install pip on Windows?
(40 answers)
Closed 4 years ago.
On my computer (windows 8.1) there is python 3.4.
When I try to install module with pip install the code that I use is:
py -m pip install ...
But the command line returns the following error:
C:\Python34\python.exe: No module named pip.__main__; 'pip' is a package and cannot be directly exec
uted

Pip is just not a standalone executable. It is a python module.
So as a matter of fact you can do this (Tested with numpy, worked correctly as wanted):
python -m pip install numpy
Well, you should see the documentation on Python.
I did mention that Pip is a standalone executable. If it is in you path then you can also do this:
pip install numpy
Make sure python is in your path.

Related

ModuleNotFoundError: No module named 'harfang'

PLEASE ,how to import harfang in ubunto for python3 ,?? it doesn't install for me !!
i tryed pip install harfang and doesn't work
Solution
The solution is to simply use
pip3 install harfang
or
python3 -m pip install harfang
If it throws error regarding pip not being installed, you can install python3-pip using apt.
Explanation
Why you were unable to install with pip directly and instead had to use pip3 is because, in ubuntu, the default python version is python 2.x. The current python versions actively maintained and supported is 3.x where x means some minor version.
Due to this reason, after you install a python 3.x installation, you need to specify if it's python3 or python2, where python is a default alias for python2.
I also mentioned about python3 -m pip install harfang. This also works, as python3 -m pip means trying to run a python module using specific python installation (which in our case is python3), you can specify which module to call using -m. You can do it with any other installed python module which has a CLI interface as well.

How to install modules for different python version of 3.x windows [duplicate]

This question already has answers here:
How to run pip from different versions of python using the python command?
(4 answers)
Closed 2 years ago.
I want to install a library that only works on python 3.7 but i also have python 3.8. I can do between 2.x and 3.x but not between 3.x verisons. Any help is appriciated thank you!
Found it!
py 3.x -m pip install <MODULE>
works!
pip install SomePackage
Eg.
pip install numpy
pip install flask

Python 3.6 virtual env uses pip from python 2.7 [duplicate]

This question already has an answer here:
pip version mismatch in venv
(1 answer)
Closed 4 years ago.
I have a virtual environment SystemModeling. I expect behavior like this:
(SystemModeling) Name-MacBook-Pro:thermofluids name$ pip --version
pip 9.0.3 from /Users/name/.virtualenvs/SystemModeling/lib/python3.6/site-packages (python 3.6)
But instead, it appears to be using pip from a the python 2.7 in my system library:
(SystemModeling) Name-MacBook-Pro:thermofluids name$ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
This is causing all kinds of issues when I try to use pip to do anything.
One possibility is shell command cache; you can clear the command cache using (bash, zsh)
hash -r
If that does not work, instead of using pip, try python -m pip to force using pip installed for current environment's python executable.

Unable to install pyaudio for python 3.6.5 [duplicate]

This question already has answers here:
Cannot install pyaudio, gcc error
(16 answers)
Closed 3 years ago.
I have Ubuntu 16.04. My system has 2 versions of Python. One is a 2.7.12(existed by default) and one is a 3.6.5 which I installed. For one of my projects I required the pyaudio module of python for which I typed in the command
sudo apt-get install python-pyaudio python3-pyaudio
It got installed successfully but the problem is that it got installed only on python 2.7.12 and not for python 3.6.5.
What should I do to get it for 3.6.5 as well?
you must Simply Download the module with pip:
pip install pyaudio
then run it on python:
>>> import pyaudio
>>>
Use pip3 it's
pip3 install pyaudio
then run it on python:
>>> import pyaudio
>>>

pip3 cannot be found after installing python3 and pip3 on a mac

python2 is installed on every mac and I installed python3 and used it a lot with the standard libraries. Now I wanted to use pip3 as I did with pip and it says:
-bash: pip3: command not found
I downloaded get-pip.pyfound in StackOverflow's answers and with installing it I got:
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages
In addition to that I tested with which pip3 and there was no output, just the new line with the normal shell. And with which pip there is the location output like I expected:
/usr/local/bin/pip
I installed python3 with the package and last month I installed brew. Maybe this created the conflict because I think I had use pip3for some libraries my installation of python3.
(What possibility do I have to use python3 without having to uninstall python2 and python3 because I need both of them and got the answer that it's no problem to install both of them?)
Thanks #phd for linking to another question. With
alias pip3='python3 -m pip'
in ~/.bash_profile I can use pip3 as used.
But I do want to know if there is still a place where pip3 is located in python3 and how I can find it?
Thanks a lot.
macOS 10.12.6 / python 2.7.10 and 3.6.4
which python>> /usr/bin/python
which python3>> /usr/local/bin/python3

Resources