How to install Python 3.5 on Raspbian Jessie

2024/10/13 21:17:58

I need to install Python 3.5+ on Rasbian (Debian for the Raspberry Pi). Currently only version 3.4 is supported. For the sources I want to compile I have to install:

sudo apt-get install -y python3 python-empy python3-dev python3-empy python3-nose python3-pip python3-setuptools python3-vcstool pydocstyle pyflakes python3-coverage python3-mock python3-pep8

But I think that apt-get will install more than these packages, for example libpython3-dev.

I already install python3 from https://www.python.org/downloads/ but I think, that is not complete.

Can you give me some suggestion which way is the best to get this?

A similar question was posted here Install Python 3.5 with pip on Debian 8 but this solution seems not to work on arm64.


Edit:

regarding to the comment of Padraic Cunningham: The first step I have done before. The second one results into this:

$ sudo python3.5 get-pip.py
Traceback (most recent call last):File "get-pip.py", line 19177, in <module>main()File "get-pip.py", line 194, in mainbootstrap(tmpdir=tmpdir)File "get-pip.py", line 82, in bootstrapimport pipFile "/tmp/tmpoe3rjlw3/pip.zip/pip/__init__.py", line 16, in <module>File "/tmp/tmpoe3rjlw3/pip.zip/pip/vcs/subversion.py", line 9, in <module>File "/tmp/tmpoe3rjlw3/pip.zip/pip/index.py", line 30, in <module>File "/tmp/tmpoe3rjlw3/pip.zip/pip/wheel.py", line 39, in <module>File "/tmp/tmpoe3rjlw3/pip.zip/pip/_vendor/distlib/scripts.py", line 14, in <module>File "/tmp/tmpoe3rjlw3/pip.zip/pip/_vendor/distlib/compat.py", line 66, in <module>
ImportError: cannot import name 'HTTPSHandler'
Answer

Head over to the RaspberryPi stackexchange and follow these instructions. To summarize:

sudo apt-get install build-essential libc6-dev
sudo apt-get install libncurses5-dev libncursesw5-dev libreadline6-dev
sudo apt-get install libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
sudo apt-get install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
cd $HOME
wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
tar -zxvf Python-3.8.6.tgz
cd Python-3.8.6
./configure       # 3 min 13 s
# Let's use 4 threads
make -j4          # 8 min 29 s
sudo make install # ~ 4 min
cd ..
sudo rm -fr ./Python-3.8.6*
# upgrade:
sudo pip3 install -U pip
sudo pip3 install -U setuptools

(Note: he approximate times shown were measurements for the older python 3.5.2.)

https://en.xdnf.cn/q/69491.html

Related Q&A

Django - last insert id

I cant get the last insert id like I usually do and Im not sure why.In my view:comment = Comments( ...) comment.save() comment.id #returns NoneIn my Model:class Comments(models.Model):id = models.Integ…

How to check if default value for python function argument is set using inspect?

Im trying to identify the parameters of a function for which default values are not set. Im using inspect.signature(func).parameters.value() function which gives a list of function parameters. Since Im…

OpenCV-Python cv2.CV_CAP_PROP_POS_FRAMES error

Currently, I am using opencv 3.1.0, and I encountered the following error when executing the following code:post_frame = cap.get(cv2.CV_CAP_PROP_POS_FRAMES)I got the following error Message:File "…

How to get the total number of tests passed, failed and skipped from pytest

How can I get to the statistics information of a test session in pytest?Ive tried to define pytest_sessionfinish in the conftest.py file, but I only see testsfailed and testscollected attributes on th…

Tensorflow ArgumentError Running CIFAR-10 example

I am trying to run the CIFAR-10 example of Tensorflow. However when executing python cifar10.py I am getting the error attached below. I have installed Version 0.6.0 of the Tensorflow package using pip…

How to plot multiple density plots on the same figure in python

I know this is going to end up being a really messy plot, but I am curious to know what the most efficient way to do this is. I have some data that looks like this in a csv file:ROI Band Min…

Running Tkinter on Mac

I am an absolute newbie. Im trying to make Python GUI for my school project so I decided to use Tkinter. When I try to import Tkinter it throws this message: >>> import tkinter Traceback (most…

Object-based default value in SQLAlchemy declarative

With SQLAlchemy, it is possible to add a default value to every function. As I understand it, this may also be a callable (either without any arguments or with an optional ExecutionContext argument).No…

High Resolution Image of a Graph using NetworkX and Matplotlib

I have a python code to generate a random graph of 300 nodes and 200 edges and display itimport networkx as nx import matplotlib.pyplot as pltG = nx.gnm_random_graph(300,200) graph_pos = nx.spring_layo…

how to read an outputted fortran binary NxNxN matrix into Python

I wrote out a matrix in Fortran as follows:real(kind=kind(0.0d0)), dimension(256,256,256) :: dense[...CALCULATION...]inquire(iolength=reclen)dense open(unit=8,file=fname,& form=unformatted,access=d…