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

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.

Related

How to get installed pip packages work in python idle?

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?

autopep8 not found in cygwin

If I try to use autopep8 in cygwin (64bit, WIndows10) i get the message "command not found".
$ autopep8
-bash: autopep8: command not found
I tried pip install autopep8 but pip is also not found, only pip2 and pip3.
If I use python -m pip install autopep8 it works so I can call
python -m autopep8
but I want to run a script where just autopep8 is called:
if ! type -p autopep8 >/dev/null; then
echo "autopep8 not found" >&2
autopep8() {
Any ideas how to solve this?
First, you must install PyPi packages to the correct Python installation, and second, you must install the same package to every Python installation in which you want to use it.
Now, a special note about installing Python on Cygwin. You have a choice of several Python versions to install, and scores of packages for use with each of those versions. Avoid Python version 2 unless you have a clearly define reason, as it is post End-of-Life. Instead, install one of the versions of Python 3. As of today, version 3.6 and 3.7 have the more complete sets of optional packages. Version 3.8 beta 4 is available.
For a my install of Python 3.8, I used the Cygwin setup app to install these packages: Python38 (Py3K language interpreter), Python38-pip (Python package installation tool), Python38-setuptools (Python package management tool), Python38-virtualenv (Creates isolated Python environments), and Python38-wheel (Python package format module). To write X11 GUI apps, add Python38-tkinter (Py3K Tkinter GUI module). To install binary packages, add Python38-devel (Py3K language interpreter).
You will be able to install pure Python packages from PyPI. To install binary packages you will also need to have the GNU compiler tool chain installed, and you will need to handle dependencies with other Cygwin packages on your own.
The Python 3.6 and 3.7 installations have addition packages which, in many cases, contain binary packages with the above mentioned dependencies already resolved, or have some useful customizations for the Cygwin environment.
Cygwin has both Python 2 and Python 3. As of today, after installation, you execute Python 2 by python and Python 3 by python3. Be careful which Python you execute as you may get a windows version of Python, if installed, and in your path. which python will always tell where the executable lives, and python -V, etc., will tell you which version you are running. Generally, you want to run a Cygwin version of Python from the bash prompt and Windows versions of Python only from the command prompt or windows GUI.
The safest way to use pip is to use the module version for the Python executable you have chosen, i.e., python -m pip, etc. This avoids having to also remember to use pip with Python and pip3 with Python3.

Cannot install python3.6 on Debian 4.9 VM

I'm running a Debian VM (4.9.189-3+deb9u1) on the Google cloud. I want to run a script on this instance; the script works fine on my local machine (Mac OSX Mojave 10.14.6; python 3.6.8). However, when I run it on the VM I get an error that seems to relate to the fact that my the VM runs python 3.4 when the script needs python 3.6+.
Here's the problem. When I run python -V, the response is Python 3.7.4. However, when I try to install the library supporting the script I want to run
pip3 install --user --upgrade -e
git+https://github.com/twintproject/twint.git#origin/master#egg=twint
I get
twint requires Python '>=3.6.0' but the running Python is 3.5.3.
I have tried changing the default python as detailed here; this doesn't seem to work––in fact, python 3.6 isn't even visible as an option when I query ls /usr/bin/python*. Can anyone offer some advice on how to proceed here? Thanks.
It seems like you have multiple Python versions available. If python -V gives you Python 3.7.4, you can use:
$ python -m pip install --user --upgrade -e git+https://github.com/twintproject/twint.git#origin/master#egg=twint
to invoke pip from that same Python interpreter.

Installing Spacy is failing with Python 3.7 on Windows 10

Installing Spacy on Windows 10 with pip is failing. Installing any other of a number of modules is working fine for me.
Here is a pastebin containing the error message:
pip install -U spacy
or
python -m pip install spacy
output:
https://pastebin.com/Y9np4veN
I have tried this both with and without virtualenv and it is failing in the same manner either way. I have also already tried installing and updating setuptools. I've ensured that I am using Python 3.7 and pip3. There is no other version of python or pip installed on my PC.
I downgraded to Python 3.6 and was able to successfully install spacy
Using x86-64 ("64-bit") version of Python 3.7 (3.7.4) instead of x86 ("32-bit") one on Windows fixed the issue for me.

Trying to install Python3 using brew

Trying to install Python3 in mac using below command :
brew install python3
When i run the command getting below error :
Error: python 2.7.14_2 is already installed
To upgrade to 3.6.5, run `brew upgrade python`
How to keep both python2 and python3 in mac without upgrading...
Thanks!
The python formula is assumed by Homebrew to be Python 3. The formula python3 is thus an alias for python.
You need to:
brew upgrade python, as told by the error message. It will switch your default Homebrew Python from 2 to 3.
brew install python#2. It will install Python 2 alongside Python 3.
Note however that even with Python 3 installed (using the formula called python), the command python still points to Python 2. You need to either type python3 to run Python 3, or add Homebrew’s Python 3 unprefixed bin directory at the beginning of your $PATH:
export PATH="$(brew --prefix python)/libexec/bin:$PATH"

Resources