I want to specify another version of Python with pyvenv

/ * I confirmed it on Ubuntu 14.04 for the time being. * /

Thing you want to do

Suppose you have already created a directory called env2_7 with pyvenv.

$ source env2_7/bin/activate
$ python -V
Python 2.7.6

I wanted to do that.

Conclusion

I'll change the python symbolic link under bin in the virtual environment directory I created.

Digression

It seems that symbolic links to each Python are put under the bin of the generated virtual environment. I changed the symbolic link of python and activated it, and it actually worked.

Take a look at the command

This is what it looks like

$ tree env2_7
env2_7
├── bin
│   ├── activate
│   ├── activate.csh
│   ├── activate.fish
│   ├── python -> python3.4
│   ├── python3 -> python3.4
│   └── python3.4 -> /usr/bin/python3.4
...

Re-establish the symbolic link,

$ ln /usr/bin/python2.7 env2_7/bin/python --symbolic

Such.


$ tree env2_7
env2_7
├── bin
│   ├── activate
│   ├── activate.csh
│   ├── activate.fish
│   ├── python -> /usr/bin/python2.7
│   ├── python3 -> python3.4
│   └── python3.4 -> /usr/bin/python3.4
...

If anyone knows how to do it with the first pyvenv command, please let us know in the comments.

Recommended Posts

I want to specify another version of Python with pyvenv
I want to debug with Python
I want to analyze logs with Python
I want to play with aws with python
I want to output the beginning of the next month with Python
I want to use MATLAB feval with python
I want to make a game with Python
How to specify attributes with Mock of python
I want to use Temporary Directory with Python2
#Unresolved I want to compile gobject-introspection with Python3
I want to solve APG4b with Python (Chapter 2)
I want to write to a file with Python
If you want to include awsebcli with CircleCI, specify the python version
Specify python version with virtualenv
I want to handle optimization with python and cplex
I want to inherit to the back with python dataclass
I want to work with a robot in python.
I want to AWS Lambda with Python on Mac!
[ML Ops] I want to do multi-project with Python
I want to run a quantum computer with Python
I want to send Gmail with Python, but I can't because of an error
I tried to find the entropy of the image with python
I want to be able to analyze data with Python (Part 3)
I want to be able to analyze data with Python (Part 1)
I want to start a lot of processes from python
I want to be able to analyze data with Python (Part 4)
I want to color black-and-white photos of memories with GAN
I want to be able to analyze data with Python (Part 2)
I want to automatically attend online classes with Python + Selenium!
[Python] I want to use the -h option with argparse
I want to know the features of Python and pip
I want to do ○○ with Pandas
[Python] I want to make a 3D scatter plot of the epicenter with Cartopy + Matplotlib!
Create another version of Python conda environment with one command line
I want to use a wildcard that I want to shell with Python remove
I want to know the weather with LINE bot feat.Heroku + Python
I want to monitor UNIQLO + J page updates [Scraping with python]
I want to solve APG4b with Python (only 4.01 and 4.04 in Chapter 4)
I want to read the html version of "OpenCV-Python Tutorials" OpenCV 3.1 version
I tried to create a list of prime numbers with python
I want to do a full text search with elasticsearch + python
I tried to fix "I tried stochastic simulation of bingo game with Python"
I want to use both key and value of Python iterator
[Introduction] I want to make a Mastodon Bot with Python! 【Beginners】
I want to check the position of my face with OpenCV!
I tried to improve the efficiency of daily work with Python
I tried to automatically collect images of Kanna Hashimoto with Python! !!
I want to detect objects with OpenCV
I want to blog with Jupyter Notebook
I want to use jar from python
I wanted to solve ABC160 with Python
I want to build a Python environment
I want to pip install with PythonAnywhere
I wanted to solve ABC172 with Python
I want to extract an arbitrary URL from the character string of the html source with python
I want to do it with Python lambda Django, but I will stop
[Note] I want to completely preprocess the data of the Titanic issue-Age version-
I want to tweet on Twitter with Python, but I'm addicted to it
(Python Selenium) I want to check the settings of the download destination of WebDriver
I want to batch convert the result of "string" .split () in Python
I want to explain the abstract class (ABCmeta) of Python in detail.