Skip to main content
added more details
Source Link

On Windows command line, the following worked for me...first First find out where your python executables are located:

where python 

This will output the paths to the different python.exe on your system. Here waswere mine:

C:\Users\carandangc\Anaconda3\python.exe C:\Python27\python.exe 

So for Python3, this was located in the first path for me, so I cd to the root folder of the application where I want to create a virtual environment folder. Then I run the following which includes the path to my Python3 executable, naming my virtual environment 'venv':

virtualenv --python=/Users/carandangc/Anaconda3/python.exe venv 

Next, activate the virtual environment:

call venv\Scripts\activate.bat 

Finally, install the dependencies for this virtual environment:

pip install -r requirements.txt 

This requirements.txt could be populated manually if you know the libraries/modules needed for your application in the virtual environment. If you had the application running in another environment, then you can automatically produce the dependencies by running the following (cd to the application folder in the environment where it is working):

pip freeze > requirements.txt 

Then once you have the requirements.txt that you have 'frozen', then you can install the requirements on another machine or clean environment with the following (after cd to the application folder):

pip install -r requirements.txt 

To see your python version in the virtual environment, run:

python --version 

Then voila, you...you have your Python3 running in your virtual environment...output Output for me:

Python 3.7.2 

On Windows command line, the following worked for me...first find out where your python executables are located:

where python 

This will output the paths to the different python.exe on your system. Here was mine:

C:\Users\carandangc\Anaconda3\python.exe C:\Python27\python.exe 

So for Python3, this was located in the first path for me, so I cd to the root folder of the application where I want to create a virtual environment folder. Then I run the following which includes the path to my Python3 executable, naming my virtual environment 'venv':

virtualenv --python=/Users/carandangc/Anaconda3/python.exe venv 

Next, activate the virtual environment:

call venv\Scripts\activate.bat 

Finally, install the dependencies for this virtual environment:

pip install -r requirements.txt 

This requirements.txt could be populated manually if you know the libraries/modules needed for your application in the virtual environment. If you had the application running in another environment, then you can automatically produce the dependencies by running the following (cd to the application folder in the environment where it is working):

pip freeze > requirements.txt 

Then once you have the requirements.txt that you have 'frozen', then you can install the requirements on another machine or clean environment with the following:

pip install -r requirements.txt 

To see your python version in the virtual environment, run:

python --version 

Then voila, you have your Python3 running in your virtual environment...output:

Python 3.7.2 

On Windows command line, the following worked for me. First find out where your python executables are located:

where python 

This will output the paths to the different python.exe on your system. Here were mine:

C:\Users\carandangc\Anaconda3\python.exe C:\Python27\python.exe 

So for Python3, this was located in the first path for me, so I cd to the root folder of the application where I want to create a virtual environment folder. Then I run the following which includes the path to my Python3 executable, naming my virtual environment 'venv':

virtualenv --python=/Users/carandangc/Anaconda3/python.exe venv 

Next, activate the virtual environment:

call venv\Scripts\activate.bat 

Finally, install the dependencies for this virtual environment:

pip install -r requirements.txt 

This requirements.txt could be populated manually if you know the libraries/modules needed for your application in the virtual environment. If you had the application running in another environment, then you can automatically produce the dependencies by running the following (cd to the application folder in the environment where it is working):

pip freeze > requirements.txt 

Then once you have the requirements.txt that you have 'frozen', then you can install the requirements on another machine or clean environment with the following (after cd to the application folder):

pip install -r requirements.txt 

To see your python version in the virtual environment, run:

python --version 

Then voila...you have your Python3 running in your virtual environment. Output for me:

Python 3.7.2 
Source Link

On Windows command line, the following worked for me...first find out where your python executables are located:

where python 

This will output the paths to the different python.exe on your system. Here was mine:

C:\Users\carandangc\Anaconda3\python.exe C:\Python27\python.exe 

So for Python3, this was located in the first path for me, so I cd to the root folder of the application where I want to create a virtual environment folder. Then I run the following which includes the path to my Python3 executable, naming my virtual environment 'venv':

virtualenv --python=/Users/carandangc/Anaconda3/python.exe venv 

Next, activate the virtual environment:

call venv\Scripts\activate.bat 

Finally, install the dependencies for this virtual environment:

pip install -r requirements.txt 

This requirements.txt could be populated manually if you know the libraries/modules needed for your application in the virtual environment. If you had the application running in another environment, then you can automatically produce the dependencies by running the following (cd to the application folder in the environment where it is working):

pip freeze > requirements.txt 

Then once you have the requirements.txt that you have 'frozen', then you can install the requirements on another machine or clean environment with the following:

pip install -r requirements.txt 

To see your python version in the virtual environment, run:

python --version 

Then voila, you have your Python3 running in your virtual environment...output:

Python 3.7.2