Pipenv and Virtualenv
pip install pipenv
pipenv install Pipfile
In Windows,you can create a virtual environment with the following: virtualenv venv --python=<insert_your_python_version_here>
where <insert_your_python_version_here>
was in my case C:\Python\Python368\python.exe
In Linux, you can create a virtual environment with virtualenv venv --python=/usr/bin/python3
.
Suppose you want to work with a specific version of Python for a project. What you can do is to set a .python-version file and then execute the main.py file with that particular version of python.
Based on the post from stackoverflow you need to execute the following commands to get up and running Python 3.7.0. (Linux Mint)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
./configure
make
sudo make altinstall
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
pyenv install 3.7.0
# install a new version in Linux
pyenv versions
# see the current versions
vi main.py
# type in this file a hello world program
pyenv local 3.7.0
# set the local python version to be 3.7.0
pyenv exec python main.py
# this will execute the python file with the 3.7.0 version
You can create a virtual environment with a specific version of Python by first setting up the Python version you want and then using that version to create your virtual environment, that is,
mkdir appPython37
# create a new folder for the app that will work with Python 3.7
pyenv local 3.7.0
# set the local version to 3.7.0
pyenv exec python -m venv env
# create the virtual environment with Python 3.7.0
With the commands from above you can have different virtual environments in various Python versions.
export PATH="/home/alexbr/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pip install virtualenv
# install virtualenv in Windows
virtualenv venv --python=C:\Python368\python.exe
# set up the virtual environment version
./activate
# You need to access to the venv folder and then Scripts. In case you are not allowed to run scripts due to the execution of scripts that is disabled then run the following command as admin in Powershell.
set-executionpolicy remotesigned
https://superuser.com/questions/106360/how-to-enable-execution-of-powershell-scripts