I've tried to install on terminal and I've used two commands:
pip install flask
pip install -U flask
It shows the same error message on both cases:
I've tried pip install -U flask
but that shows the same error.
Here is the error I'm getting:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting flask
Using cached https://files.pythonhosted.org/packages/9a/74/670ae9737d14114753b8c8fdf2e8bd212a05d3b361ab15b44937dfd40985/Flask-1.0.3-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from flask)
Using cached https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl
Collecting itsdangerous>=0.24 (from flask)
Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Werkzeug>=0.14 (from flask)
Using cached https://files.pythonhosted.org/packages/9f/57/92a497e38161ce40606c27a86759c6b92dd34fcdb33f64171ec559257c02/Werkzeug-0.15.4-py2.py3-none-any.whl
Collecting click>=5.1 (from flask)
Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in /usr/lib/python2.7/dist-packages (from Jinja2>=2.10->flask) (0.23)
Installing collected packages: Jinja2, itsdangerous, Werkzeug, click, flask
Found existing installation: Jinja2 2.8
Uninstalling Jinja2-2.8:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib/python2.7/dist-packages/Jinja2-2.8.egg-info/entry_points.txt'
Consider using the `--user` option or check the permissions.
Best way is probably to use pip install <libname> --user
Meaning in your case use pip install flask --user
This installs the package for your user and that is safe. Also you have probably the right of installing the package for the user.
The permission error you have encountered is a frequent problem. As can be seen here: pip is not able to install packages correctly: Permission denied error and here error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied
Using the sudo pip command is not considered as safe as explained here: What are the risks of running 'sudo pip'?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.