10

Flaskをインストールしようとしていますが、これらすべての警告とエラーに賭けています。

alex@alex-K43U:~/flask$ pip install Flask
Downloading/unpacking Flask
  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)
  Downloading Werkzeug-0.8.3.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)
  Downloading Jinja2-2.6.tar.gz (389Kb): 389Kb downloaded
  Running setup.py egg_info for package Jinja2

    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'
Installing collected packages: Flask, Werkzeug, Jinja2
  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 '/usr/local/lib/python2.7/dist-packages/flask': Permission denied
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/alex/flask/build/Flask/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-KD7NsY-record/install-record.txt:
    running install

running build

(a lot of creating and building)

error: could not create '/usr/local/lib/python2.7/dist-packages/flask': Permission denied

この問題を解決するための提案はありますか?

ubuntu 11.10を使用しています。

4

2 に答える 2

16

安全に無視できる警告。ただし、このエラー:

error: could not create '/usr/local/lib/python2.7/dist-packages/flask': Permission denied

これをグローバル システムの Python にインストールしようとしているとのことです。それは何も悪いことではありませんが、それを行いたい場合は、昇格された特権でコマンドを実行する必要があります (を使用sudo)。

システム全体の Python インストールを汚染しないように、仮想環境を使用することをお勧めします。

仮想環境の使用:

$ virtualenv flask_env
$ source flask_env/bin/activate
(flask_env) $ pip install Flask

おそらく最初にvirtualenvバイナリをインストールする必要がありますsudo apt-get install python-virtualenv

于 2012-10-22T15:52:09.590 に答える
6

警告に関しては、無視できる場合があります。関連する唯一の行は最後の行で、アプリケーションにはそのフォルダーにディレクトリを作成する権限がないことを示しています。

これを修正するには、コマンドに追加sudoします。

sudo pip install Flask

原則として、パッケージをシステム全体にインストールすることは望ましくありません。Python の世界では、通常、仮想環境を使用してローカル環境を作成し、これらのそれぞれにパッケージをインストールします。詳細については、こちらを参照してvirtualenv ください

于 2012-10-22T15:52:30.217 に答える