Suddenly I don't use pythonbrew anymore. There are some reasons
Is it pythonz now? If you want to install multiple versions, you should use pythonz. But I'm not using pythonz right now.
Occasionally, I switch between 2 and 3 due to the library's convenience, so I can do it without using an external tool. The Mac has 2 series, and it is enough to add 3 series such as brew.
When I need more than one version, I wonder if it's about testing to publish something, but I can do that with Travis CI or something.
When I think about it, the only thing I often used with pythonbrew was to create a virtual environment. That's venv. So, I settled down on my machine by simply creating an environment with venv. usually! So far, I have no problems. The law of good is that everyone is good.
http://methane.hatenablog.jp/entry/2013/11/05/Mac_%E3%81%A7_Python_%E3%81%AE%E9%96%8B%E7%99%BA%E7%92%B0%E5%A2%83%E6%A7%8B%E7%AF%89(2013_11)
Postscript is over.
$ git clone https://github.com/utahta/pythonbrew
$ ./pythonbrew-install
$ vi ~/.bashrc
source $HOME/.pythonbrew/etc/bashrc
#If you enter it as root, it may be this one ~ ↓ ↓ ↓
source /usr/local/pythonbrew/etc/bashrc
Rereading .bashrc, you can use pythonbrew or pybrew command
#Take the plunge and use v3!
$ pybrew install 3.3.0
$ pybrew venv create testenv -p 3.3.0 #testenv is optional
$ pybrew install --framework 3.3.0 #For mac
$ pybrew venv use testenv
$ python --version
Python 3.3.0 #Hooray
#In the state of using something with pybrew
$ pip install Flask
$ pip install WTForms
$ pip install sqlalchemy
$ pip install psycopg2 #For PostgreSQL
$ pip install flask-mail
$ pip install Flask-Script
$ pip install Beaker #Session management
$ pip install uwsgi
hello.py
# coding=utf-8
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello'
@app.route('/indo')
def hello_world_indo():
return 'नमस्ते'
if __name__ == '__main__':
app.run(host='0.0.0.0',debug=True)
$ python hello.py
http://[サーバのIP]:5000 You can see it in. Yay.
During development, start up normally without using uWSGI as before, and in the production environment, it feels like nginx + uWSGI + Flask. This time, I just tried something like "Isn't it really possible to start using uWSGI?"
$ uwsgi --http :9090 --python-path /var/app/testpy -w hello:app
http://[サーバのIP]:9090 You can see it in.
This may not be enough to make a startup script. This is the version that works anytime.
$ /usr/local/pythonbrew/venvs/Python-3.3.0/testenv/bin/uwsgi --http :9090 -H /usr/local/pythonbrew/venvs/Python-3.3.0/testenv --python-path /var/app/testpy -w hello:app
http://[サーバのIP]:9090 You can see it in.
Dissolution!
Recommended Posts