There is always a colorful river in the fairy tale town
Sometimes there are some strange problems when installing the python environment. For example, some packages can’t be installed anyway. Due to the python version, some environment deployments are really troublesome. Therefore, I recommend using a virtual environment to deploy Python. For example, a project creates a separate python virtual environment that does not interfere with other projects. There are a lot of python virtual environment tools, here mainly introduce virtualenv and pyenv.
Virtualenv is cross-platform, linux, mac, windows can be used.
Description: After the creation is completed, a kvenv directory will be generated. You can add the Python version with the -p parameter. (Of course, you must have a version of python installed to create this version of the virtual directory.)
Note: Mac, linux and windows are installed in the same way.
Pyenv is strictly a version controller of Python and is very flexible to use.
- pyenv version # current version
- pyenv versions # all versions
- pyenv global system # global switch
- pyenv local 2.7.10 # Local switch
- pyenv local 3.5.0 –unset # cancel switching
Pyenv common commands
Install other versions of python
If it is a project environment, it is recommended that virtualenv, the environment is independent, there will be no big bugs.
If you are just learning to practice python, you can use pyenv to switch easily.