Answer the question
In order to leave comments, you need to log in
Can't build Python 3.7 from official sources?
All good and hello! I want to put myself a newer "Snake", namely 3.7 ( because some of the window family does not want to work ). First I download the sources from the site, I make sudo make altinstall
a mistake here too.
I run to the official docks , download CPython from GitHub , compile, and at the same moment I get the same error. What to do (please tell me)?
Oops, here's the error:
running install_scripts
copying build/scripts-3.7/idle3.7 -> /usr/local/bin
copying build/scripts-3.7/pydoc3.7 -> /usr/local/bin
copying build/scripts-3.7/pyvenv-3.7 -> /usr/local/bin
copying build/scripts-3.7/2to3-3.7 -> /usr/local/bin
changing mode of /usr/local/bin/idle3.7 to 755
changing mode of /usr/local/bin/pydoc3.7 to 755
changing mode of /usr/local/bin/pyvenv-3.7 to 755
changing mode of /usr/local/bin/2to3-3.7 to 755
rm /usr/local/lib/python3.7/lib-dynload/_sysconfigdata_m_linux_x86_64-linux-gnu.py
rm -r /usr/local/lib/python3.7/lib-dynload/__pycache__
/usr/bin/install -c -m 644 ./Misc/python.man \
/usr/local/share/man/man1/python3.7.1
if test "xupgrade" != "xno" ; then \
case upgrade in \
upgrade) ensurepip="--altinstall --upgrade" ;; \
install|*) ensurepip="--altinstall" ;; \
esac; \
./python -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Traceback (most recent call last):
File "/home/timosha/cpython-3.7/Lib/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/timosha/cpython-3.7/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/timosha/cpython-3.7/Lib/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/home/timosha/cpython-3.7/Lib/ensurepip/__init__.py", line 204, in _main
default_pip=args.default_pip,
File "/home/timosha/cpython-3.7/Lib/ensurepip/__init__.py", line 117, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/home/timosha/cpython-3.7/Lib/ensurepip/__init__.py", line 27, in _run_pip
import pip._internal
File "/tmp/tmpv8cl2p7b/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/__init__.py", line 42, in <module>
File "/tmp/tmpv8cl2p7b/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/cmdoptions.py", line 16, in <module>
File "/tmp/tmpv8cl2p7b/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 25, in <module>
File "/tmp/tmpv8cl2p7b/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 39, in <module>
File "/tmp/tmpv8cl2p7b/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in <module>
File "/home/timosha/cpython-3.7/Lib/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Makefile:1132: ошибка выполнения рецепта для цели «altinstall»
make: *** [altinstall] Ошибка 1
PS: All commands were executed as root (sudo) _-| Ubuntu 16.04.4 LTS |-_
Answer the question
In order to leave comments, you need to log in
Guide
How to install the required version of python for one user in the home directory
You do not need to change the system python
Run like this python3.7 -v
Wrong python3 -v
Why?
What is required to install for assembly in ubunts 16.xx-18.xxwhich python3.7; which python3
apt-get install -y \
build-essential git libexpat1-dev libssl-dev zlib1g-dev \
libncurses5-dev libbz2-dev liblzma-dev \
libsqlite3-dev libffi-dev\
libffi-dev tcl-dev linux-headers-generic libgdbm-dev \
libreadline-dev tk-dev \
libdb-dev \
libmpdec-dev \
libncursesw5-dev
cd /tmp
git clone https://github.com/python/cpython.git
cd cpython
git checkout 3.7
--prefix=$HOME/.local/bin
--prefix=$HOME/.local
${prefix}/{bin,include,lib,share}
./configure --prefix=$HOME/.local --enable-optimizations
make -j4
make install
├── bin
│ ├── 2to3 -> 2to3-3.7
│ ├── 2to3-3.7
│ ├── easy_install-3.7
│ ├── idle3 -> idle3.7
│ ├── idle3.7
│ ├── pip3
│ ├── pip3.7
│ ├── pydoc3 -> pydoc3.7
│ ├── pydoc3.7
│ ├── python3 -> python3.7
│ ├── python3.7
│ ├── python3.7-config -> python3.7m-config
│ ├── python3.7m
│ ├── python3.7m-config
│ ├── python3-config -> python3.7-config
│ ├── pyvenv -> pyvenv-3.7
│ └── pyvenv-3.7
├── include
│ └── python3.7m
├── lib
│ ├── libpython3.7m.a
│ ├── pkgconfig
│ └── python3.7
│ └── man
which python3.7
it does not give a result - check for the presence in PATH ~./local/bin$ grep "$HOME/.local/bin:" <<< "$PATH"
/home/sim3x/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:
Instructions on how to install and build a python deb package in a few steps , which can later be installed on other hosts without any problems. + can be removed/updated via dpkg.
Relevant for all versions of python and Ubuntu 12/14/16 (just substitute the correct link).
You can also use any python through docker:
docker run -it python:3.7
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question