Python has a very rich library, and you can use commands such as pip
and ʻeasy_install` to select the library you want to use.
It's easy to install.
However, if you install the library without thinking about it,
I don't know which library is needed for the program I'm running,
It's sad that it works after updating due to a dependency problem between libraries.
Fortunately, python has a program to solve this problem, virtualenv,
There is a program called virtualenvwrapper that makes it easy to use.
This page introduces how to install and use virtualenvwrapper when running python on windows. Please refer to here for installing python.
Start a command prompt and type pip install virtualenvwrapper-win
virtualenv and virtualenvwrapper for windows will be installed.
If you get the following message when you try to execute it, it is possible that the PATH is not in your path or the python library has not been installed properly.
'pip'Is an internal or external command,
It is not recognized as a workable program or batch file.
Even if you say to create or switch the environment, you don't know what it is.
First, try typing pip freeze
at the command prompt.
If you just installed it, you'll probably see only two, virtualenv
and virtualenvwrapper-win
.
By the way, the number after ==
indicates the version number of the library.
Let's create a new environment.
Creating the environment is mkvirtualenv envname
. Enter any name you like for * envname *.
In the example, it is named myproject
.
When you execute the command, the environment is created and the environment is activated. If the virtual environment is activated, (* envname *) will be displayed on the left side of the usual display of the command prompt.
In the (* myproject *) environment, nothing is displayed even if you type pip freeze
because you have not installed any libraries yet.
In the case of windows (when using virtualenvwrapper-win), a virtual environment is created in the following location. C:\Users\ username \Envs\ envname
command | effect | Annotation |
---|---|---|
mkvirtualenv envname | Creating a new environment | After creating the environment, the environment is activated |
workon | Environment list display | |
workon envname | envnameActivate your environment | |
deactivate | Get out of the virtual environment | Invalid if not in virtual environment |