I recently installed Fedora 26, and it came with python3.6 already installed. However, the application I plan on running uses python3.4 instead. I want to continue using python3.4 so I installed it using dnf. So when I type pip3 -V to se what version of pip3 I'm using, I get this: pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6). How would I make it so that pip3 installs in pip 9.0.1 from /usr/lib/python3.4/site-packages (python 3.4) instead of python3.6?
Here are some things I have tried.
When running this command python3.4 -m pip, I get this error: /usr/bin/python3.4: No module named pip. When I tried to reinstall pip, it reinstalls pip-3.6. Also, I noticed that I don't have the pip-3.4 package.
Any help is greatly appreciated.
Download this script
Open your terminal and execute it using the command
[root#server ~]# python3.4 get-pip.py
This should install pip to your Python 3.4 installation
Then you can access your pip package manager for your Python 3.4 installation using
[root#server ~]# python3.4 -m pip install <module>
Output on my computer:
>> ekavala#elx750xhv:~$ python3.4 --version
> Python 3.4.3
>> ekavala#elx750xhv:~$ python3.4 -m pip -V
> pip 9.0.1 from /usr/local/lib/python3.4/dist-packages (python 3.4)
Related
I'm running CentOS 8 that came with native Python 3.6.8. I needed Python 3.7 so I installed Python 3.7.0 from sources. Now, python command is unknown to the system, while commands python3 and python3.7 both use Python 3.7.
All good until now, but I can't seem to get pip working.
Command pip returns command not found, while python3 -m pip, python3.7 -m pip, python3 -m pip3, and python3.7 -m pip3 return No module named pip. Only pip command that works is pip3.
Now whatever package I install via pip3 does not seem to install properly. Example given, pip3 install tornado returns Requirement already satisfied, but when I try to import tornado in Python 3.7 I get ModuleNotFoundError: No module named 'tornado'. Not the same thing can be said when I try to import it in Python 3.6, which works flawlessly. From this, I understand that my pip only works with Python 3.6, and not with 3.7.
Please tell me how can I use pip with Python 3.7, thank you.
It looks like your python3.7 does not have pip.
Install pip for your specific python by running python3.7 -m easy_install pip.
Then, install packages by python3.7 -m pip install <package_name>
Another option is to create a virtual environment from your python3.7. The venv brings pip into it by default.
You create venv by python3.7 -m venv <venv_name>
I think the packages you install will be installed for the previous version of Python. I think you should update the native OS Python like this:
Install the python3.7 package using apt-get
sudo apt-get install python 3.7
Add python3.6 & python3.7 to update-alternatives:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
Update python3 to point to Python 3.7:
`sudo update-alternatives --config python3
Test the version:
python3 -V
I have both python2 and python3 in my system. But when I try :
python -m pip install sklearn
bash shows :
/usr/bin/python: No module named pip
And
pip --version
Yields :
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
Python versions are Python 2.7.18 and Python 3.8.2.
How to correct this error by having two pip versions?
This is a similar question, but did not solve the issue.
OS is Ubuntu.
Thanks to HK boy
The following works, it installs pip explicitly for the python version specified :
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
I already had pip3 before hand, so to install packages for python3, pip3 install <package> is enough.
I have default python version 2.6.6 and pip is working with that. But
when I installed python2.7, it was installed in different path(
/usr/local/bin/python2.7). My main concern is pip is not working with
2.7 and getting error No module named pip. Is it possible to install separate pip for 2.7 or we can use existing pip with 2.7. Please
suggest.
[jack#server ~]$ python --version
Python 2.6.6
[jack#server ~]$ which python
/usr/bin/python
[jack#server ~]$ which pip
/usr/bin/pip
[jack#server ~]$ which python2.7
/usr/local/bin/python2.7
[jack#server ~]$ python2.7 --version
Python 2.7
[jack#server ~]$ sudo python2.7 -m pip install pymongo
[sudo] password for jack:
/usr/local/bin/python2.7: No module named pip
I am seeing some weird stuff on my system:
$ pip install python-binance-api
...Library/Python/2.7/lib/python/site-packages (from python-binance-api) (3.13.2)
...
python versions:
$ python --version
Python 2.7.14
10:05 PM ~/kittycapital add_more_curr
$ python3 --version
Python 3.6.4
My pip is still installing to python 2.7 when I want it to install on python3. How do I get it to do this?
If I want the commands pip and python to point to python 3.7, what can I do?
Solution 1
python3 -m pip install xxx
# for example: python3.7 -m pip install requests
Solution 2
virtualenv --python=python3.7 venv
source venv/bin/activate
pip install requests
Solution 3
pipenv --python 3.7 # python3 -m pip install pipenv --user
pipenv shell
pipenv install requests
I download the python3 package , and install it, and I find the pip3 is installed too.
aircraftdeMacBook-Pro:~ ldl$ which python3
aircraftdeMacBook-Pro:~ ldl$ which pip3
....there I install the .dmg for python3 I download from the upper link.
aircraftdeMacBook-Pro:~ ldl$ which python3
/usr/local/bin/python3
aircraftdeMacBook-Pro:~ ldl$ python3 --version
Python 3.5.2
aircraftdeMacBook-Pro:~ ldl$ which pip3
/usr/local/bin/pip3
So , I want to confirm if the pip3 package is include in the .dmg file, because when install the python3 the pip3 is installed too.
from the command lines you can see I only instal the python3 dmg, but the pip3 is installed too.
This is as expected.
Newer releases of Python 3 (3.4+?) come with pip pre-installed, as well as with the ensurepip module.