virtualenv is a package that allows you to create a virtual environment for Python. You will be able to change the Python version for each project, and install and run the required packages separately.
$ sudo easy_install virtualenv
・ ・ ・
Installed /Library/Python/2.7/site-packages/virtualenv-1.11.6-py2.7.egg
Processing dependencies for virtualenv
Finished processing dependencies for virtualenv
$
Success if such a log appears.
Create a project directory.
$ mkdir PythonTest
Execute virtualenv command
$ virtualenv --no-site-packages PythonTest
New python executable in PythonTest/bin/python
Installing setuptools, pip...done.
$
If successful, you will see a log like this. This will create a virtual environment.
You can use the virtual environment by executing the source command for bin / activate in the created directory.
$ cd PythonTest
$ source bin/activate
(PythonTest)%
If the virtual environment can be started, the console ** (directory name)% ** as shown above will be started. Use this console to install the required packages.
(PythonTest)% deactivate
%
You can deactivate the virtual environment by typing ** deactivate **.
(PythonTest)%pip install package
Recommended Posts