简体   繁体   中英

Install Flask in Python 3.4+ NOT for python2.7

So, I know how to actually install flask, via pip install Flask

But, I'm running a virtualenv with python3.4 . The problem is, Flask is in fact installed. The problem is though, it is installed for python2.7 and not python3.4 .

I did run this command with the virtualenv activated via source bin/activate , but it seems to install it for python2.7 even though a virtualenv running python3.4 is activated.

How do I fix this? im pulling my hair out over this.

Thanks

Since Python 3.3, you can use venv instead of virtualenv (see PEP 405 ). If you do so, running source bin/activate will set python command to python 3 and use the right pip.

you can create the environnement using:

python3 -m venv myEnvName

Hope this helps

If you are using Pycharm just switch to python 3, and there is a list of packages installed. Hit add(+), and look for flask

You can switch to python 3 by hitting file-> setting -> Project:Projectname -> Project Interpreter

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM