[python] How to upgrade Python version to 3.7?

I have python3.5 already in linux ubuntu. I have downloaded the python3.7.tar www.python.org.

But i have no idea how to install it. How to upgrade to python 3.7? Thanks.

This question is related to python linux python-3.x ubuntu

The answer is


Try this if you are on ubuntu:

sudo apt-get update
sudo apt-get install build-essential libpq-dev libssl-dev openssl libffi-dev zlib1g-dev
sudo apt-get install python3-pip python3.7-dev
sudo apt-get install python3.7

In case you don't have the repository and so it fires a not-found package you first have to install this:

sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update

more info here: http://devopspy.com/python/install-python-3-6-ubuntu-lts/


On ubuntu you can add this PPA Repository and use it to install python 3.7: https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.7

Or a different PPA that provides several Python versions is Deadsnakes: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa

See also here: https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get (I know it says 3.6 in the url, but the deadsnakes ppa also contains 3.7 so you can use it for 3.7 just the same)

If you want "official" you'd have to install it from the sources from the site, get the code (which you already downloaded) and do this:

tar -xf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure
make
sudo make install        <-- sudo is required.

This might take a while


Questions with python tag:

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation Upgrade to python 3.8 using conda Unable to allocate array with shape and data type How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip How to prevent Google Colab from disconnecting? "UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure." when plotting figure with pyplot on Pycharm How to fix 'Object arrays cannot be loaded when allow_pickle=False' for imdb.load_data() function? "E: Unable to locate package python-pip" on Ubuntu 18.04 Tensorflow 2.0 - AttributeError: module 'tensorflow' has no attribute 'Session' Jupyter Notebook not saving: '_xsrf' argument missing from post How to Install pip for python 3.7 on Ubuntu 18? Python: 'ModuleNotFoundError' when trying to import module from imported package OpenCV TypeError: Expected cv::UMat for argument 'src' - What is this? Requests (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.") Error in PyCharm requesting website How to setup virtual environment for Python in VS Code? Pylint "unresolved import" error in Visual Studio Code Pandas Merging 101 Numpy, multiply array with scalar What is the meaning of "Failed building wheel for X" in pip install? Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed Could not install packages due to an EnvironmentError: [Errno 13] OpenCV !_src.empty() in function 'cvtColor' error ConvergenceWarning: Liblinear failed to converge, increase the number of iterations How to downgrade python from 3.7 to 3.6 I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."? Iterating over arrays in Python 3 How do I install opencv using pip? How do I install Python packages in Google's Colab? How do I use TensorFlow GPU? How to upgrade Python version to 3.7? How to resolve TypeError: can only concatenate str (not "int") to str How can I install a previous version of Python 3 in macOS using homebrew? Flask at first run: Do not use the development server in a production environment TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array What is the difference between Jupyter Notebook and JupyterLab? Pytesseract : "TesseractNotFound Error: tesseract is not installed or it's not in your path", how do I fix this? Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'" How do I resolve a TesseractNotFoundError? Trying to merge 2 dataframes but get ValueError Authentication plugin 'caching_sha2_password' is not supported Python Pandas User Warning: Sorting because non-concatenation axis is not aligned

Questions with linux tag:

grep's at sign caught as whitespace How to prevent Google Colab from disconnecting? "E: Unable to locate package python-pip" on Ubuntu 18.04 How to upgrade Python version to 3.7? Install Qt on Ubuntu Get first line of a shell command's output Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running? Run bash command on jenkins pipeline How to uninstall an older PHP version from centOS7 How to update-alternatives to Python 3 without breaking apt? How to post raw body data with curl? Copy Files from Windows to the Ubuntu Subsystem How to use local docker images with Minikube? Can Windows Containers be hosted on linux? gradlew command not found? ssh connection refused on Raspberry Pi Composer: file_put_contents(./composer.json): failed to open stream: Permission denied Curl : connection refused boto3 client NoRegionError: You must specify a region error only sometimes gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now sudo: docker-compose: command not found How to upgrade pip3? How can I remove jenkins completely from linux Linux Command History with date and time MySQL fails on: mysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded" What is difference between arm64 and armhf? How to redirect output of systemd service to a file Retrieve last 100 lines logs Failed to find Build Tools revision 23.0.1 Run an Ansible task only when the variable contains a specific string What does `set -x` do? How to edit a text file in my terminal Starting a shell in the Docker Alpine container How to run SUDO command in WinSCP to transfer files from Windows to linux Fail during installation of Pillow (Python module) in Linux How to install Android SDK on Ubuntu? How do I delete virtual interface in Linux? What is the default root pasword for MySQL 5.7 Docker command can't connect to Docker daemon How to find files modified in last x minutes (find -mmin does not work as expected) Can I use Homebrew on Ubuntu? Pycharm and sys.argv arguments Ubuntu: OpenJDK 8 - Unable to locate package Fork() function in C Amazon Linux: apt-get: command not found Ionic android build Error - Failed to find 'ANDROID_HOME' environment variable Ubuntu: Using curl to download an image Docker error response from daemon: "Conflict ... already in use by container" Curl command without using cache Can't get private key with openssl (no start line:pem_lib.c:703:Expecting: ANY PRIVATE KEY)

Questions with python-3.x tag:

Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation Replace specific text with a redacted version using Python Upgrade to python 3.8 using conda "Permission Denied" trying to run Python on Windows 10 Python: 'ModuleNotFoundError' when trying to import module from imported package What is the meaning of "Failed building wheel for X" in pip install? How to downgrade python from 3.7 to 3.6 I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."? Iterating over arrays in Python 3 How to upgrade Python version to 3.7? TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array How do I resolve a TesseractNotFoundError? Could not find a version that satisfies the requirement tensorflow Not able to pip install pickle in python 3.6 json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 190) installing urllib in Python3.6 pip install returning invalid syntax Unable to import path from django.urls Display all dataframe columns in a Jupyter Python Notebook How to make Firefox headless programmatically in Selenium with Python? How to import cv2 in python3? Pipenv: Command Not Found Error in Python script "Expected 2D array, got 1D array instead:"? Fixed digits after decimal with f-strings How do I upgrade the Python installation in Windows 10? Pip error: Microsoft Visual C++ 14.0 is required Python error message io.UnsupportedOperation: not readable Anaconda Installed but Cannot Launch Navigator Conda command is not recognized on Windows 10 TypeError: can't pickle _thread.lock objects How do you fix the "element not interactable" exception? How to print a specific row of a pandas DataFrame? Relative imports - ModuleNotFoundError: No module named x SyntaxError: unexpected EOF while parsing ImportError: No module named 'django.core.urlresolvers' Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'? What is the purpose of "pip install --user ..."? Add Legend to Seaborn point plot How to install pip for Python 3.6 on Ubuntu 16.10? Python sockets error TypeError: a bytes-like object is required, not 'str' with send function WinError 2 The system cannot find the file specified (Python) Python 3.6 install win32api? error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte Python 3 - ValueError: not enough values to unpack (expected 3, got 2) matplotlib: plot multiple columns of pandas data frame on the bar chart Unable to set default python version to python3 in ubuntu TypeError: '<=' not supported between instances of 'str' and 'int' pandas: merge (join) two data frames on multiple columns Replacing a character from a certain index Scrolling to element using webdriver?

Questions with ubuntu tag:

grep's at sign caught as whitespace "E: Unable to locate package python-pip" on Ubuntu 18.04 How to Install pip for python 3.7 on Ubuntu 18? "Repository does not have a release file" error ping: google.com: Temporary failure in name resolution How to install JDK 11 under Ubuntu? How to upgrade Python version to 3.7? Issue in installing php7.2-mcrypt Install Qt on Ubuntu Failed to start mongod.service: Unit mongod.service not found When I run `npm install`, it returns with `ERR! code EINTEGRITY` (npm 5.3.0) Cannot open new Jupyter Notebook [Permission Denied] Can't install laravel installer via composer Yarn install command error No such file or directory: 'install' Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running? How to completely uninstall python 2.7.13 on Ubuntu 16.04 How to update-alternatives to Python 3 without breaking apt? How to open the terminal in Atom? How to install/start Postman native v4.10.3 on Ubuntu 16.04 LTS 64-bit? How to install "ifconfig" command in my ubuntu docker image? How to install pip for Python 3.6 on Ubuntu 16.10? Default password of mysql in ubuntu server 16.04 How to install PHP intl extension in Ubuntu 14.04 Unable to set default python version to python3 in ubuntu updating nodejs on ubuntu 16.04 Docker Repository Does Not Have a Release File on Running apt-get update on Ubuntu Curl : connection refused How to install all required PHP extensions for Laravel? Getting permission denied (public key) on gitlab Cannot import keras after installation Docker - Ubuntu - bash: ping: command not found Copy Paste in Bash on Ubuntu on Windows How to install php-curl in Ubuntu 16.04 PHP XML Extension: Not installed webpack command not working sudo: docker-compose: command not found How to find which version of TensorFlow is installed in my system? How to fix git error: RPC failed; curl 56 GnuTLS How to tell if tensorflow is using gpu acceleration from inside python shell? Docker Error bind: address already in use MySQL fails on: mysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded" How to use systemctl in Ubuntu 14.04 Package php5 have no installation candidate (Ubuntu 16.04) How to enable php7 module in apache? Is there a keyboard shortcut (hotkey) to open Terminal in macOS? To enable extensions, verify that they are enabled in those .ini files - Vagrant/Ubuntu/Magento 2.0.2 After installing with pip, "jupyter: command not found" How to verify if nginx is running or not? How to install Android SDK on Ubuntu? Docker-Compose can't connect to Docker Daemon