Installing the same python environment on another machine

Asked
Active3 hr before
Viewed126 times

7 Answers

machineinstallingenvironmentpython
90%

This tutorial walks you through installing and using Python packages,,Congratulations, you now know how to install and use Python packages! ✨ 🍰 ✨,Installing packages for your project,This puts you back to the system’s default Python interpreter with all its installed libraries

Example_snippet/controller/utility/_machine.js/ $ python --version . . .
$ python--version
load more v
88%

A Word About “System Python”,Help, I can’t install a package into my Virtual Environment,Building a Local Version of Python,Other Versions of Python

Example_snippet/controller/utility/_machine.js/ $ python3.7 -m venv my_venv_py. . .
$ python3 .7 - m venv my_venv_py37
Step 2 continued with $ source my_venv_py37/bin/acti. . .
$ source my_venv_py37 / bin / activate

(my_venv_py37) $ python--version
Python 3.7 .3

   (my_venv_py37) $ python - m pip install six
Collecting six
Downloading...
   Installing collected packages: six
Successfully installed six - 1.12 .0

(my_venv_py37) $ python - m pip freeze
six == 1.12 .0

(my_venv_py37) $ python - c "import six; print(six.__version__)"
1.12 .0

   (my_venv_py37) $ deactivate

$
Step 3 continued with $ python3.7 -m venv my_venv_py. . .
$ python3 .7 - m venv my_venv_py37

$ my_venv_py37 / bin / python--version
Python 3.7 .3

$ my_venv_py37 / bin / python - m pip install six
Collecting six
Downloading...
   Installing collected packages: six
Successfully installed six - 1.12 .0

$ my_venv_py37 / bin / python - m pip freeze
six == 1.12 .0

$ my_venv_py37 / bin / python - c "import six; print(six.__version__)"
1.12 .0
Step 4 continued with $ source my_project_venv/bin/a. . .
$ source my_project_venv / bin / activate

(my_project_venv) $ python - m pip freeze > requirements.txt
Step 5 continued with $ source new_project_venv/bin/. . .
$ source new_project_venv / bin / activate

(new_project_venv) $ python - m pip install - r requirements.txt
Step 6 continued with $ rm -rf my_project_venv. . .
$ rm - rf my_project_venv
Step 7 continued with $ source my_project_venv/bin/a. . .
$ source my_project_venv / bin / activate

(my_project_venv) $ python - m pip freeze > requirements.txt

(my_project_venv) $ deactivate

$
Step 8 continued with $ source new_project_venv/bin/. . .
$ source new_project_venv / bin / activate

(new_project_venv) $ python - m pip install - r requirements.txt

(new_project_venv) $ deactivate

$
Step 9 continued with /bin/python3 /bin/python3.6 /u. . .
/bin/python3 /
bin / python3 .6 /
   usr / bin / python3 /
   usr / bin / python3 .6
Step 10 continued with $ scl enable rh-python36 "pyth. . .
$ scl enable rh - python36 "python3.6 --version"
Python 3.6 .3
Step 11 continued with $ scl enable rh-python36 "pyth. . .
$ scl enable rh - python36 "python3.6 -m venv my_venv_py36"
Step 12 continued with $ source my_venv_py36/bin/acti. . .
$ source my_venv_py36 / bin / activate

(my_venv_py36) $ python - m pip install six
Collecting six
   [...]
Successfully installed six - 1.12 .0

(my_venv_py36) $ python - m pip freeze
six == 1.12 .0

(my_venv_py36) $ python3 .6 - c "import six; print(six.__version__)"
1.12 .0

   (my_venv_py36) $ deactivate

$
Step 13 continued with $ my_venv_py36/bin/python3.6 -. . .
$ my_venv_py36 / bin / python3 .6 - c "import six; print(six.__version__)"
1.12 .0
Step 14 continued with $ mkdir /n/fs/myproject/temp . . .
 $ mkdir / n / fs / myproject / temp
 $ cd / n / fs / myproject / temp
 $ wget https: //www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
Step 15 continued with $ tar xJf Python-3.8.0.tar.xz. . .
 $ tar xJf Python - 3.8 .0.tar.xz
 $ cd Python - 3.8 .0
 $. / configure--prefix = /n/fs / myproject / py38
 $ make;
 make install
Step 16 continued with $ /n/fs/myproject/py38/bin/py. . .
 $ / n / fs / myproject / py38 / bin / python3 .8 - m venv / n / fs / myproject / myvenv
 $ / n / fs / myproject / myvenv / bin / python--version
 Python 3.8 .0
Step 17 continued with $ cd /n/fs/myproject/temp $ . . .
 $ cd / n / fs / myproject / temp
 $ rm - rf Python - 3.8 .0.tar.xz Python - 3.8 .0
load more v
72%

Cool! Then what are the other ways to create a copy of existing virtualenv locally?,Second way to create a copy of existing virtualenv(Recommended):,One of the way to create a copy of existing virtualenv is mentioned below:,First way to create a copy of existing virtualenv, say ProjectAenv:

Example_snippet/controller/utility/_machine.js/ cp -R /home/sk/Path1/ProjectAe. . .
cp - R / home / sk / Path1 / ProjectAenv / home / sk / Path2 / ProjectBenv
load more v
65%

Multiple paths can be given to venv, in which case an identical virtual environment will be created, according to the given options, at each provided path,,Installs activation scripts appropriate to the platform into the virtual environment

Example_snippet/controller/utility/_machine.js/ python3 -m venv /path/to/new/v. . .
python3 - m venv / path / to / new / virtual / environment
load more v
75%

virtualenv is used to manage Python packages for different projects, Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects

Example_snippet/controller/utility/_machine.js/ python3 -m pip install --user . . .
python3 - m pip install--user--upgrade pip

python3 - m pip--version
load more v
40%

In the new virtualenv, ask pip to install those libraries with the same version :,First of all this is a Python/Anaconda question and should probably be asked in a different stack exchange subsite,,In the working virtualenv, create a file with the version of each installed Python library :,In case the above one does not work (due to the various issues of conda itself), it's always worth a try with the following variation:

Example_snippet/controller/utility/_machine.js/ conda env export > environment. . .
conda env
export > environment.yml
Step 2 continued with conda env create -f environmen. . .
conda env create - f environment.yml
Step 3 continued with conda create -n yourenvname py. . .
conda create - n yourenvname python = x.x anaconda
Step 4 continued with source activate yourenvname . . .
source activate yourenvname
load more v
22%

Meta Stack Overflow , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers , Stack Overflow help chat ,Stack Overflow em Português

Example_snippet/controller/utility/_installing.js/ Suppose another PC does not in. . .
Suppose another PC does not install Python
Python version: 3.7 .3
Platform: Platform: Windows 10, 7(64 bit)
load more v