Specify the Python executable to use with virtualenv

It is a memorandum.

For example, suppose you have the Python 2.7 executable in / usr / bin / python and the Python 3.4 executable in / usr / bin / python3.

At this time, if you mkvirtualenv with the default settings, / usr / bin / python will be copied to ~ WORKON_HOME / # {envname} / bin / python.

The point is that if you normally mkvirtualenv, a copy of the python environment that appears with which python will be created, but for example, you want to create a virtual environment for Python3, or / opt / bin / python2.6. I think that there is a version and you may want to use this one.

In such a case, it is a method to explicitly specify the Python executable file to be used in virtualenv.

$ which python3
/usr/bin/python3
$ mkvirtualenv py3test --python=/usr/bin/python3
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in py3test/bin/python3
Also creating executable in py3test/bin/python
Installing setuptools, pip...done.
(py3test)$ 
(py3test)$ python
Python 3.4.0 (default, Apr 11 2014, 13:05:11)   ## Python3.It's 4! !!
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Let's specify the --python option when mkvirtualenv. This option can be passed directly from virtualenvwrapper to virtualenv to serve its purpose.

Recommended Posts

Specify the Python executable to use with virtualenv
Specify MinGW as the compiler to use with Python
The easiest way to use OpenCV with python
Specify python version with virtualenv
[Python] How to use virtualenv
[Python] How to specify the download location with youtube-dl
Python: How to use async with
Use rospy with virtualenv in Python3
How to use FTP with Python
Solution when you want to use cv_bridge with python3 (virtualenv)
[Python] I want to use the -h option with argparse
[Introduction to Python] Let's use foreach with Python
The road to compiling to Python 3 with Thrift
[Python] Explains how to use the format function with an example
How to use the C library in Python
How to use virtualenv
Use pipdeptree with virtualenv
How to specify the NIC to scan with amazon-dash
[Python] Use JSON with Python
I want to use MATLAB feval with python
Specify the browser to use with Jupyter Notebook. Especially Mac. (And Vivaldi)
[Python] Explains how to use the range function with a concrete example
If you want to include awsebcli with CircleCI, specify the python version
The easiest way to synthesize speech with python
Try to solve the man-machine chart with Python
Use logger with Python for the time being
Use mecab with Python3
Use python on Raspberry Pi 3 to light the LED with switch control!
Use DynamoDB with Python
Say hello to the world with Python with IntelliJ
How to specify attributes with Mock of python
How to use virtualenv
Use Python 3.8 with Anaconda
I want to use Temporary Directory with Python2
Use python with docker
[Algorithm x Python] How to use the list
Use the Python framework "cocotb" to test Verilog.
Introduction to Python with Atom (on the way)
How to use tkinter with python in pyenv
Try to use up the Raspberry Pi 2's 4-core CPU with Parallel Python
Try to solve the programming challenge book with python3
[Introduction to Python] How to iterate with the range function?
Try to solve the internship assignment problem with Python
The first algorithm to learn with Python: FizzBuzz problem
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
How to use python interactive mode with git bash
Convert the image in .zip to PDF with Python
I wanted to use the Python library from MATLAB
I want to inherit to the back with python dataclass
[Python] How to use the graph creation library Altair
[Introduction to Udemy Python3 + Application] 27. How to use the dictionary
[Introduction to Udemy Python3 + Application] 30. How to use the set
[Python] Summary of how to specify the color of the figure
How to use the model learned in Lobe in Python
I tried to solve the problem with Python Vol.1
[Python] How to rewrite the table style with python-pptx [python-pptx]
Site notes to help you use NetworkX with Python
Try to specify the axis with PyTorch's Softmax function
I want to use the R dataset in python
Use Trello API with python