It's safe to have two versions of Python in a Cloudera virtual machine without installing Python

We currently have a big data cluster built using Cloudera-Virtual machines. By default, the virtual machine version of Python is 2.7.

For one of my programs, I need Python 3.6. My team is very skeptical about two installations and is afraid to break an existing cluster / VM. I planned to follow this article and install 2 versions of https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos -6-4

Is there a “I can package Python version 3.6” method in my project and install the Python home path in my project folder so that there is no installation that needs to be done on an existing virtual machine?

Since we need to download python and create a source for the Unix version, I want to skip this part on the VM and instead send a folder with Python 3.6

+4
source share
2 answers

It seems that minicondais what you need. using it, you can manage multiple python environments with different versions of python.

to install miniconda3 only:

# this will download & install miniconda3 on your home dir
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3

then create a new python3.6 env:

conda create -y -n myproject 'python>3.6'

enter new python3.6 env

source activate myproject
python3

minicondacan also install python packages, including package packages and compiled packages. You can also copy envs from one machine to another. I urge you to study it more deeply.

+2
source

ShmulikA offer is pretty good.

- Python 2.7.x, Python 3.x. pyenv.

, , :

pyenv install 3.x.x

Python:

pyenv versions

, :

pyenv local 3.x.x

.python-version , :

[nahmed@localhost ~]$ cat some-project/.python-version 
3.5.2

:

[nahmed@localhost ~]$ pyenv versions
* system (set by /home/nahmed/.pyenv/version)
  3.5.2
  3.5.2/envs/venv_scrapy
  venv_scrapy
[nahmed@localhost ~]$ pyenv local 3.5.2
[nahmed@localhost ~]$ pyenv versions
  system
* 3.5.2 (set by /home/nahmed/.python-version)
  3.5.2/envs/venv_scrapy
  venv_scrapy

. post ( ).


:

python Unix , Python 3.6

, Python Python:

Windows Linux bbfreeze, pyinstaller

from - SOAnswer.

0

Source: https://habr.com/ru/post/1684145/


All Articles