On Linux Ubuntu with python 3.6.9
When i try to download pip, it says i already have it. So when i try to pip install ... it gives me error "bash: pip: command not found".
When i type "which pip" in the terminal it gives me nothing and creates a new line.
(While also it doesn't work in the normal terminal) I should also say I'm trying to do this in a virualenv. It gives the same errors when trying to install pip (I already have it) and when trying to use pip ("bash: pip: command not found")
echo $PATH output: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
sorry if this doesn't make sense, kinda a noob
Try the following:
python -m pip install ....
python3 -m pip install ....
py3 -m pip install ....
As #S3DEV commented, there could be a problem with your path variables, so trying python before pip could solve. Those other variations (python3 and py) can also work.
Related
I'm working on macos and using python 3.8. I executed pip3 install virtualenv which seemed to run without errors. Now however, virtualenv on the command line comes back with a command not found error. No output from a which command either. Where would pip3 have placed the virtualenv binary?
Thanks!
I recently installed Python 3 and when I wanted to check the version, it says it is Python 2.7
As I understand it, the new MacOS comes with Python 2.7 so that seems to not be the issue.
So when I want to install pip it keeps saying
command not found
How do I install pip then? Help me please
Try the following command:
pip3 install package-name
If you still get the same error message, refer to the following link to get detailed instructions on pip installation on macOS:
https://www.geeksforgeeks.org/how-to-install-pip-in-macos/
I had almost the same problem, what I did was to install Homebrew first.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
then add it to the path
after that you can install Python 3 by typing the following command :
$ brew install python
to check if Python3 has been installed type :
$ python3 --version
I would get in the habit of using a virtual environment for every project. Treat the stock system installations as an implementation detail of the OS, not something you should be modifying directly.
You can start with something as simple as
# Ignore the system-installed Python 2
python3 -mvenv venv
. venv/bin/activate
Now python and pip will each refer to the correct versions found in the virtual environment.
I am trying to use pip to install discord.py. When I simply type pip install discord.py, it defaults to 2.7 and complains that it needs 3.4+. When I say python3 -m pip [command], nothing is printed to stdout, and as far as I can tell nothing happens at all. What am I doing wrong?
EDIT: The problem seems to extend to all python3 commands - "python3 --version" doesn't do anything either.
Resolution: I installed Python 3.8.0 earlier today. I restarted my computer, and now the default version has been changed to 3.8.0 and everything's working just fine.
check python version
python3 --version
if it is 3.5+ , good , then do in terminal
python3 go to python prompt
import pip check if pip is there or not if not then install it
in ubuntu run command sudo apt install python3-pip
verify again it is installed or not
then do python3 -m pip install discord.py
try using python3 -m pip3 [command] instead. pip3 is used to install python 3 packages.
I highly recommend using a virtual environment. So if you perform virtualenv -p python3 you will have a python3 environment. Then source bin/activate then you should be able to successfully run pip 3 commands simply by using pip install discord.py. Hope this helps!
I'm trying to install some libraries on python, and I open cmd and type-m pip install <lib_name> but it says there's syntax error. When I skip the "<" it says pip is not a recognized command. Any help? I'm using Python 3.6.5.
enter image description here
this is the output for almost every command I'm trying...
first of all we need to know if you are good to go with pip.
Try posting the output of
pip --version
If pip doesn't seem to be installed, you should install it via
python -m ensurepip --default-pip
Once pip is installed you can install packages using the command
pip install whatever
Here's a complete starter pack tutorial for using pip :)
https://packaging.python.org/tutorials/installing-packages/
you can enter either cmd into the terminal:
python -m pip install <package-name>
or
pip install <package-name>
The first will always install into your global environment and the second could depend on whether you're in a virtualenv (if none of this makes sense to you, don't worry about it).
First install python!
According to your screenshot, it is not installed... (or not available, in that case check your PATH in system properties).
Having a weird problem with pip on os x.
As far as I can recall (and a quick look at my .bash_history seems to confirm) I have not made any recent changes to my configuration. Alas, the pip command seems to be suddenly using a different version of python than it was previously. Up until now I was using the command pip to manage my python2 libraries and pip3 to manage by python3 libraries. Suddenly, any attempts at running pip install fails with errors like missing parenthesis around print statements.
Here is the result of a few commands I attempted to figure out the problem:
which pip > /usr/local/bin/pip
which pip3 > /usr/local/bin/pip3
which python > /usr/local/bin/python
python version > Python 2.7.11
pip --version > pip 8.1.1 from /usr/local/lib/python3.5/site-packages (python 3.5)
So for some reason the pip command seems to be running from the PyPi2 database but in python3 now? Any ideas how to fix this?
I run with multiple Python versions and thus multiple pip versions as well.
Everytime, however, you update pip, you'll replace the standard pip command with the version you updated. So even pip3 install --upgrade pip will put a /usr/local/bin/pip in your system, messing up the Python 2 version.
Instead, I run pip as an (executable) module:
python3 -m pip search <package>
or
python2 -m pip search <package>
or even
python3.5 -m pip search <package>
This guarantees that your pip version always matches the Python version you want to use it for. It's somewhat longer to type, but I prefer the expliciteness of it (which, I guess, follows the Zen of Python).
Note that updating pip:
python3.5 -m pip install --upgrade pip
will still install a Python 3.5 version in /usr/local/bin/pip, but I'm simply ignoring that. Just beware of (shell) scripts that execute pip directly.
Find absolute path to Python you'd like to use:
which python
Open your default pip executable script:
vi $(which pip)
You will see a shebang line at the top which may point to wrong Python (i had that once too).
Point to the Python you want (see step 1), e.g.:
#!/usr/local/bin/python3.7
Try setting aliases by running the following commands in Terminal,
alias pip="/usr/local/bin/pip"
alias pip2="/usr/local/bin/pip"
alias pip3="/usr/local/bin/pip3"
If this solves your problem then you need to add the aliases in your bash profile.
Look How do I create a Bash alias? for more info.
Alternatively, you have to reinstall pip using python2 get-pip.py first and then python3 get-pip.py get-pip.py can be downloaded here https://bootstrap.pypa.io/get-pip.py
I had exactly the same problem!
I reinstall python2 by brew brew reinstall python#2
after reinstall, pip install packagename works!
None of these worked for me so what I did was navigate to
C:\Users(User)\AppData\Local\Programs\Python\
and deleted all the old python versions I wasn't using. (Worked)