3

次のチュートリアルに従おうとしています http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world#commentform

私はとても迷っているようです。まずは分かるところから。コマンド「python virtualenv.py Flask」を実行すると、フォルダ「flask」内に仮想 python 環境が作成されます。これは正しいです?

第二に、これは、このフォルダーに cd してから 'pip install Flask' を実行すると、フラスコをそのフォルダーにインストールする必要があるということではありませんか? これらの pip install コマンドのいずれかを実行すると、端末が理解できないクレイジーな状態でいっぱいになります。

Benjamins-MacBook:flask test$ pip install flask==0.9
Downloading/unpacking flask==0.9
Downloading Flask-0.9.tar.gz (481kB): 481kB downloaded
Running setup.py egg_info for package flask

warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
Downloading/unpacking Werkzeug>=0.7 (from flask==0.9)
Downloading Werkzeug-0.9.4.tar.gz (1.1MB): 1.1MB downloaded
Running setup.py egg_info for package Werkzeug

warning: no files found matching '*' under directory 'werkzeug/debug/templates'
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
Downloading/unpacking Jinja2>=2.4 (from flask==0.9)
Downloading Jinja2-2.7.1.tar.gz (377kB): 377kB downloaded
Running setup.py egg_info for package Jinja2

warning: no files found matching '*' under directory 'custom_fixers'
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
Downloading/unpacking markupsafe (from Jinja2>=2.4->flask==0.9)
Downloading MarkupSafe-0.18.tar.gz
Running setup.py egg_info for package markupsafe

Installing collected packages: flask, Werkzeug, Jinja2, markupsafe
Running setup.py install for flask

warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
error: could not create '/Library/Python/2.7/site-packages/flask': Permission denied
Complete output from command /usr/bin/python -c "import          setuptools;__file__='/private/var/folders/9l/6fgb2st97cs2b2jkj7g4bs5m0000gp/T/pip_build_test/flask/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9l/6fgb2st97cs2b2jkj7g4bs5m0000gp/T/pip-PbWDVv-record/install-record.txt --single-version-externally-managed:

私が間違っていることは何か分かりますか?

4

3 に答える 3

7

bin/activatevirtualenv を有効にするには、最初に新しいフラスコ フォルダーでスクリプトをソースする必要があります。

実行している場合bash(ほとんどの場合)、次を実行します。

cd new/flask/directory
. bin/activate
pip install ...

virtualenv から抜けたい場合は、ターミナル タブを終了するか、次のコマンドを実行します。

deactivate

virtualenv をアクティブにすると、現在いる 1 つのターミナル タブでのみアクティブになることに注意してください。

最初にそのコマンドを実行しないpipと、システム ディレクトリにインストールしようとするため、表示されている権限エラーが発生します。

于 2013-08-28T02:47:47.573 に答える