Or, if you created a Python module yourself and want to validate that it runs correctly on different Python versions, you need a way to install several Python versions on your system. And most of those projects require different Python versions and depend on other modules like a particular version of numpy, for example. Thank you for reading the DevopsRoles page! Install pyenv, Install pyenv.Why should you use pyenv and Virtual Python Environments?Īs a programmer, either employed at a company, freelancer or even as a hobbyist, you usually work on multiple programming projects simultaneously. You have to Install pyenv and manage multiple python versions. To deactivate environment settings pyenv deactivate app Useful Commands Conclusion pyenv virtualenv 3.6.6 appĮnable environment settings pyenv activate app If the installation fails, maybe your system lacks the necessary libraries for compiling, install the missing libraries hereĬreate a virtual environment with virtualenv, which uses Python 3.6.6. The output terminal as below ~]$ pyenv install 3.6.6 Path ~/projects/demo $ pyenv install 3.6.6 # Uncomment the following line if you don't like systemctl's auto-paging feature:Įxport PATH="/home/vagrant/.pyenv/bin:$PATH"Įval "$(pyenv virtualenv-init ~]$ source ~]$ pyenv -versionįor example, I will introduce how to use pyenv to set up a virtual environment using python 3.6.6 for the project demo. The output terminal config file ~/.bashrc as below ~]$ cat. Then insert the following 3 lines into the shell’s config file ~/.bashrc export PATH="/home/vagrant/.pyenv/bin:$PATH" # Load pyenv-virtualenv automatically by adding # See the README for instructions on how to set up WARNING: seems you still have not added 'pyenv' to the load path. Remote: Total 10 (delta 1), reused 6 (delta 0), pack-reused 0 Remote: Total 61 (delta 11), reused 22 (delta 0), pack-reused 0 Remote: Compressing objects: 100% (55/55), done. Remote: Total 10 (delta 1), reused 5 (delta 0), pack-reused 0Ĭloning into '/home/vagrant/.pyenv/plugins/pyenv-virtualenv'. Remote: Compressing objects: 100% (6/6), done. Receiving objects: 100% (16/16), 5.78 KiB | 5.78 MiB/s, done.Ĭloning into '/home/vagrant/.pyenv/plugins/pyenv-update'. Remote: Total 16 (delta 1), reused 10 (delta 0), pack-reused 0 Remote: Compressing objects: 100% (13/13), done. Receiving objects: 100% (11/11), 38.71 KiB | 1.49 MiB/s, done.Ĭloning into '/home/vagrant/.pyenv/plugins/pyenv-installer'. Remote: Total 11 (delta 1), reused 3 (delta 0), pack-reused 0 Remote: Compressing objects: 100% (9/9), done. Remote: Total 882 (delta 493), reused 565 (delta 338), pack-reused 0 The output terminal install pyenv as below curl -L | bash You can view the installation instructions from Pyenv’s homepage on Github or use the command below $ curl -L | bash Xz-utils tk-dev libffi-dev liblzma-dev Install pyenv Libreadline-dev libsqlite3-dev wget curl libncurses5-dev libncursesw5-dev \ On Ubuntu sudo apt-get install make build-essential libssl-dev zlib1g-dev libbz2-dev \ On Rocky Linux / Centos sudo yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel Pyenv integrates with the Virtualenv plugin to support creating virtual environments (virtual environments), and library projects will be installed in isolation in this virtual environment without affecting the system.It also offers the ability to quickly switch from one version of Python to another. Pyenv is a fantastic tool for installing and managing multiple Python versions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |