I installed brew
and then
brew install python
brew install python3
Install flask
with pip
pip install flask
Try
python -c 'import flask'
But I got exception
ImportError: No module named flask
Set and export PYTHONPATH
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
So far so good. But when I tried to install a package with pip3
for Python 3, I got error message
Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
PYTHONPATH is currently: ":/usr/local/lib/python2.7/site-packages"
You should `unset PYTHONPATH` to fix this.
How to use site-packages without the PYTHONPATH
trick to make both pip
and pip3
usable and both Python 2 and Python 3 able to import site-packages?
Aucun commentaire:
Enregistrer un commentaire