how to install latest version of python and pip in arch linux? - python-3.x

My default operating system is ArchLinux and the Python version installed on it is 3.1.
I installed version 3.9 using aur, but I do not know how to systematize this version of Python by default and install pip for it, because when I try to use pip, I get this message:
$ python3.9 -m pip
/usr/bin/python3.9: No module named pip

Pip should be installed normally, and if not, there should be a package for pip, but if you cannot install it for whatever reason, installing pip can be done via the ensurepip module:
python -m ensurepip
Reference the documentation for more information.

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.

pip install doesn't find my highest installed version of python

My problem is that when I try to install a product that requires python >= 3.7, the installer fails, saying that it could not find the required python version, even though I do have python 3.8 installed.
I'm running Ubuntu for Windows 10 (the MS-store product.)
It comes with python 3.6 installed.
From a clean ubuntu install, I
sudo apt update
sudo apt install python3.8
sudo apt install python3-pip
At this point the command "python" is not mapped (not available), but I can run "python3" to get python3.6 or "python3.8" to get that version.
pip3 reports that it is using python 3.6.
pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
So it appears that pip is not recognizing the python 3.8 that I have.
When I attempt my product install, it fails, indicating that
sudo pip3 install --verbose (mypackage name)
(... various messages...)
(requires-python:>=3.7) is incompatible with the pythonversion in use. Acceptable python versions are:>=3.7
Could not find a version that satisfies the requirement cbordplatform (from versions: )
No matching distribution found for (my package name)
How can I get pip3 to recognize my python3.8?
If you want to make sure that pip is using the correct version of Python, call it with the specific Python like this:
python3.8 -m pip ...

How to install xlrd in python3 library

I am trying to install xlrd to read Excel files in python.
I have tried this: pip install -U pip setuptools. My macOS Mojave 10.4.3 has Python 2.7 which is where the default install goes to. But I have also installed Python3.7. How do I get pip install to my 3.7 directory?
I am on Mac machine(Catalina -version 10.15.5) and below pip3 command worked for me.
pip3 install xlrd
python version : 3.7.6
OS : Mac-Catalina(10.15.5)
Thanks to #Tapan Hegde, pip3 install xlrd worked from me, after installing the pip3, like this:
sudo apt update
apt install python3-pip
pip3 install xlrd
I reckon the easiest/cleanest solution would be to use a tool that isolates your python environment, such as virtualenv
Once installed, create a virtual env by specifying which version of python you want to use:
$> virtualenv -p python3 env
Note: puttin python3 directly works only for mac, with linux, you must specify the absolute path or your python binary.
And then 'activate' your environment:
$> source env/bin/activate
From here, any python or pip command you use will use python3.
$> pip install xlrd
Virtualenv has the advantage of not 'polluting' your local python installation, your can manage your pip modules installed more easily.
If you want more detail on how it works and the other alternatives, check this post
When pip install xlrd not work and in computer is still old version, then try do it with current version, for example pip install xlrd==2.0.1.
The current versions are here

Python3.6 is installed but pip3 command not found on Mac os x

I have installed python3.6 and Jupiter Notebooks on my computer using anaconda. Now, I need to install TensorFlow for python3. To show the version of pip: I type these command:
pip -V: pip 9.0.1 from /Users/xxx/anaconda3/lib/python3.6/site-packages (python 3.6).
pip3 -V: command not found.
What I understand is pip pointed to python3.6 and I can use it to install Tensorfolw (it is like a alias to pip3). Is it correct?

Use or install different versions of python3 pip

I'm trying to install packages for my python 3.5.0 versus my python 3.4.3
I can run both by typing either python3.4 or python3.5
I have pip2 and pip3. I also ran the script sudo easy_install3 pip, which made me be able to use pip3.4 But I am still having trouble installing modules for python3.5. pip3 just installs for python3.4
I am looking to install termcolor for python3.5 and I am having no success. Can anyone help?
I am on Windows, and you appear not to be, but maybe the following will help.
If pip is in your system's equivalent of python35/Lib/site-packages, then python3.5 -m pip should run pip so that it installs into the 3.5 site-packages.
If you do not have pip in the 3.5 site-packages, copy its directory, along with its dependencies (pip....dist-info/, setuptools/, setuptools....dist-info/, and easyinstall.py) from the 3.4 site_packages.
Or, if pip3 or even pip3.4 is in python35/Scripts, run it with its full path name so you are not running the 3.4 version.

Resources