How to get installed pip packages work in python idle? - python-3.x

I am using ubuntu 20.04 and i installed pip through terminal by using command "sudo apt install python3-pip" and i installed colorgram python package through terminal.My problem was i am able to work with colorgram package in terminal but not in python idle.
How to use installed python package in python idle?

Related

'ModuleNotFoundError: No module named 'MySQLdb' '

I am using python3 to learn flask. When i connected it to a Mysql database using xampp, it shows the above mentioned error. is it a version problem or something else?
You need to use one of the following commands. Which one depends on what OS and software you have and use.
easy_install mysql-python (mix os)
pip install mysql-python (mix os/ python 2)
pip install mysqlclient (mix os/ python 3)
apt-get install python-mysqldb (Linux Ubuntu, ...)
cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)
yum install MySQL-python (Linux Fedora, CentOS ...)
For Windows, see this answer: Install mysql-python (Windows)
Run the command below to add the python mysql connector to your python environment.
pip install mysqlclient

no module named "pip" in python

I am on python 3.8.5 I am using python and pip, pipenv recently without any issue on any terminal and project. But, today when I try to do anything with pip or pipenv, I get this error
No Module Named "pip"
I even installed python latest version again and I know that on 3.8.5, I don't have to download pip. I can't even check the pip version in the terminal.
Type in sudo apt-get install python3-pip in the terminal to install pip

which python3 returns nothing after Ubuntu 20.04 upgrade

After I installed the new Ubuntu 20.04 (update form 19.10), Python seems to have major path problems, and also Jupyter notebooks are not working anymore.
which python3 returns nothing (no response)
If I try to install a new Python version with sudo apt install python3.8 I get the answer
python3.8 is already the newest version (3.8.2-1ubuntu1).
Trying export PYTHONPATH="/my/former/working/python/path" also changes
nothing (still no response to which python)
Did you check if you have Python in /usr/bin/python3?
If you do
sudo apt list | grep python
Do you see the Python package?
I think the best bet for you would be to remove python3 and install it again. I know 19.10 had Python 3.7 and 20.04 has Python 3.8 and that might be causing some conflict.
You can remove the Python package by
WARNING : USE WITH CAUTION THIS COMMAND MAY DELETE A LOT OF PACKAGES FROM YOUR SYSTEM
sudo apt purge python3
and reinstall with
sudo apt install python3

How to set running python as pyhton3.6 in ubuntu?

While installing a project requirement file (pip install -r requirements.txt) terminal is giving this error:
css-html-js-minify requires Python '>=3.6' but the running Python is 2.7.12
I think the issue is due to the library “css-html-js-minify” which requires a Python version >= 3.6.
Try using pip3.
Note that on some Linux distributions including Ubuntu and Fedora the pip command is meant for Python 2, while the pip3 command is meant for Python 3.
Installing Python on Linux.

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

Resources