Skip to content

Python3 Compatibility

André Silva edited this page Jun 12, 2017 · 2 revisions

So , how did I start ,moving this project to python 3

first of all, internet: http://flask.pocoo.org/docs/0.12/python3/

then, let's install pip, but wign python 3 https://stackoverflow.com/questions/10763440/how-to-install-python3-version-of-package-via-pip-on-ubuntu

http://python-guide-pt-br.readthedocs.io/en/latest/starting/install3/osx/ http://python-guide-pt-br.readthedocs.io/en/latest/dev/virtualenvs/#virtualenvironments-ref

default location

/usr/local/bin/python3.6

if not ifnd

which python3.6

➜ flask-template-project git:(master) mkvirtualenv flask-template --python=/usr/local/bin/python3.6 Running virtualenv with interpreter /usr/local/bin/python3.6 Using base prefix '/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6' New python executable in /Users/andreffs18/.virtualenvs/flask-template/bin/python3.6 Also creating executable in /Users/andreffs18/.virtualenvs/flask-template/bin/python Installing setuptools, pip, wheel...done. virtualenvwrapper.user_scripts creating /Users/andreffs18/.virtualenvs/flask-template/bin/predeactivate virtualenvwrapper.user_scripts creating /Users/andreffs18/.virtualenvs/flask-template/bin/postdeactivate virtualenvwrapper.user_scripts creating /Users/andreffs18/.virtualenvs/flask-template/bin/preactivate virtualenvwrapper.user_scripts creating /Users/andreffs18/.virtualenvs/flask-template/bin/postactivate virtualenvwrapper.user_scripts creating /Users/andreffs18/.virtualenvs/flask-template/bin/get_env_details (flask-template) ➜ flask-template-project git:(master) pip install -r requirements.txt

Update all requirements https://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip pip freeze --local | grep -v '^-e' | cut -d = -f 1 | xargs -n1 pip install -U

if for some reason, you find yourself with this problem:

AttributeError: module 'bcrypt._bcrypt' has no attribute 'ffi'

you need to do the following

$ brew install pkg-config libffi $ export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/ $ pip install bcrypt

biggest issue was with base64 formating stiring.. it only hadles byte representation instead of str so we ned to encode in bytes and decode after so we can

https://docs.python.org/2/library/2to3.html

Clone this wiki locally