Python 3.4 not showing pip as available module - python-3.x

I have Python 2.7.6 and Python 3.4.3. I am trying to use websocket in my python application but it seems it won't install for python 2.7.6 so I am using python 3. Supposedly pip comes with python 3.4 but I am unsure about how to use it.
pip3 doesn't return anything
python3 -m pip returns no module named pip
What could be the issue here. How do I access my pip for python3 and so I can install websockets?
I am running Ubuntu 14.04.1

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 specify python version to use when leveraging pip

I'm trying to run pip to install some libraries for python 2.7, but in my windows shell, its identifying it with python 3.X that I have installed and installing the packages to the python libs folder, or some folder relative to python 3.x. How can I specify pip to install specified package to only 2.7 in the CLI instead of python 3, and vice-versa?
Perhaps I should try to use virtual environment with python 3 running and run pip from there?
pip install pyvisa
I expect this to be an issue because I have no unique environment variable to specify which version of python I want pip to use.
Try py -2 -m pip install pyvisa for Python 2 and py -3 -m pip install pyvisa for Python 3. The py launcher that allows you to run stuff both in Python 2 and in Python 3 comes bundled with recent versions of both Python 2 and Python 3 for Windows, but it's optional. If you chose not to install py, you can instead use C:\Python2\python.exe -m pip install pyvisa, as an example -- substitute your own Python 2 path there.

no module named `numpy` in python 3.6 interpreter

I'm using Python 3.6 v in Ubuntu 18.04LTS. I installed numpy package using pip. When i used Python 3.6 interpreter it throws
ModuleNotFoundError: No module named 'numpy' and for Python2.7
interpreter it didn't throws any error. Any suggestions will be very helpful. I searched in google and github nothing helped me.
Based on the outputs you posted -
your pip and python are pointing to version 2.7
if you try pip install numpy you will install into your python 2.7 env
if you start python interpreter by default you'll be starting python2.7 and you should be able to find numpy package installed.
if you want to do the same in python3.xx use python3 , pip3 or use
virtual environments

How to install modules in Python 2.7 insted of Python 3.6?

I have two versions of Python in my laptop. Python 2.7 and Python 3.6. If install a module this is installed only in Python 3.6.
I would like to install modules in Python 2.7 through pip but I don't know how to do it.
I want to install right now GDAL and Fiona for Python 2.7 in Ubuntu 17.04.
If Python 2.7 is well installed on your system, you should have python2 and/or python2.7 commands and you could run the following:
python2.7 -m pip install <your-packages>
To make sure you are running the correct python version, you can use python2.7 --version
Better use virtual environment for this.
Follow this link https://realpython.com/blog/python/python-virtual-environments-a-primer/
You can set python version to use in virtual env using
virtualenv -p path/to/python2.7 env_name
Activate this env using . env_name/bin/activate then,
Use pip install package_name to install libraries inside virtual environment

Python3 can't find urllib3

I have Python 2.7.3 installed alongside Python 3.2.3 on an Ubuntu system.
I've installed urllib3 using pip and can import it from the python shell. When I open the python3 shell, I get a can't find module error when trying to import urllib3. help('modules') from within the shell also doesn't list urllib3.
Any ideas on how to get python3 to recognize urllib3?
You need to install it for each version of Python you have - if pip installs it for Python 2.7, it won't be accessible from 3.2.
There doesn't seem to be a pip-3.2 script, but you can try easy_install3 urllib3.

Resources