Learn flask, install virtualenv environment, these belts are OK, but an installation package always error can not be installed,
http://e.pypi.python.org/This is the official website, Tsinghua University provides
Recommended for non-Tsinghua campus Use this image: Http://e.pypi.python.org/simple (This is also a http://pypi.v2ex.com/simple), Tsinghua University in the use of this:/http Mirrors.tuna.tsinghua.edu.cn/pypi/simple
Using the mirroring method, you can add the parameter "-I http://e.pypi.python.org/simple" Each time Pip is executed,
Alternatively, you can configure it locally so that you don't have to add parameters each time, and apply the cheer Xiao Configuration (http://blog.makto.me/post/2012-11-01/pypi-mirror):
[Plain]
- Users who use the PIP can be configured as follows:
- In Unix and MacOS, the configuration file is: $HOME/.pip/pip.conf
- On Windows, the configuration file is:%home%\pip\pip.ini
- You need to add the following in the configuration file:
- [Global]
- Index-url=http://mirrors.tuna.tsinghua.edu.cn/pypi/simple
There is also a small trick, is to put all the packages to be installed in a file, such as Requirement.txt (each package to write a line, the top of the wardrobe), and then PIP installation only need to add the parameter "-R requirement.txt".
After installation, experienced a, the speed of the ~ ~
Ps:
Steps to use:
1. Enter the directory using the command:virtualenv env
2.source Env/bin/activate, this time you will find an extra (env) logo in front of the command line, indicating that you have entered the virtual environment.
Write a simple hello.py verification:
[Python]
- #!/usr/bin/python
- From Flask Import flask
- App = Flask (__name__)
- @app. Route ('/', methods = [' GET ', ' POST '])
- def hello ():
- return ' Hello world! '
- if __name__ = = ' __main__ ':
- App.run ()
Hint no flask package, use the method above Pip, Pip install-i http://e.pypi.python.org/simple flask, super fast, install, run, OK.
Why did you install the wine OK? And does not affect the original package of the system?
Look at the contents of the Env directory and findthese installed packages in the ENV/L ib/pythonx.x/site-packages directory, such as my following:
[Plain]
- Distribute-0.6.24-py2.7.egg Itsdangerous-0.23-py2.7.egg-info Jinja2-2.7.1-py2.7.egg-info setuptools.pth
- Easy-install.pth itsdangerous.py Markupsafe Werkzeug
- Flask ITSDANGEROUS.PYC Markupsafe-0.18-py2.7.egg-info werkzeug-0.9.3-py2.7.egg-in Fo
- Flask-0.10.1-py2.7.egg-info JINJA2 Pip-1.1-py2.7.egg
This is what a virtual machine does.
Finally, I can concentrate on the flask with peace of mind.
#2013.08.27
Direct installation flask Installs the latest 0.10 version, it is tragic that many expansion packs have not yet followed this version, so many features can not be used OH ~ ~ such as the Falsk-mail version
So still reinstall Flask version 0.9, but this is not a thing, with envitualenv after the environment is very easy, today tried the-I http://e.pypi.python.org/simple I can't believe it! , find this mirror address good http://pypi.v2ex.com/simple
Oh, it's also easy to install the Flask0.9 version, just pip install flask==0.9.
(decide after each article to put a funny picture, let yourself happy AH)
linux--using a domestic image to install some Python packages via Pip