To implement pyramid tutorial on Linux (debian) How to create a virtual python environment using virtualenv
Before, I tried to create an environment by groping, but since I learned a lot, I reorganized it.
For the time being, prepare three, setuptools, pip, and virtualenv.
#Installation of setuptools
$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python
#Easy when setuptools is installed_Install pip and virtualenv as install will be available
$ easy_install pip
$ easy_install virtualenv
You may need administrator privileges according to your environment.
Build a virtual environment using virtualenv
#Build a virtual environment named sample
$ virtualenv --no-site-packages sample
By activating after building the environment, You can use the environment.
#sample Activate in virtual environment
$ cd sample
$ source bin/activate
If successful, the environment name will be displayed in () in the command. In the above case, it looks like (sample).
Deactivate command when leaving the environment
#Get out of the environment
$ deactivate
Install puramid while in the virtual environment. Work location is directly under the virtual environment directory
$ pip install pyramid
By the way, in my environment, this command installed Pyramid 1.4.5. It's different from the tutorial version, but I wonder if it can be managed.
Then follow Install Pyramid Tutorial Install what you need. Somehow I'm using pip instead of easy_install.
・ Project creation
$ bin/pcreate -s alchemy tutorial
-Installing the project in development mode
$ cd tutorial
$ python setup.py develop
・ Test execution
$ python setup.py test -q
・ Extraction of test coverage information
$ pip install nose coverage
$ ../bin/nosetests --cover-package=tutorial --cover-erase --with-coverage
-Database initialization
$ ../bin/initialize_tutorial_db development.ini
・ Launch application
$ ../bin/pserve development.ini --reload
This will start the server. This completes Tutorial installation.
Recommended Posts