我正在尝试为Pyramid Web框架运行"hello world" application,但收到以下错误。有人可以告诉我我需要安装什么。感谢
C:\Python27>python pyramid_hello.py
Traceback (most recent call last):
File "pyramid_hello.py", line 2, in <module>
from pyramid.config import Configurator
File "C:\Python27\lib\site-packages\pyramid-1.5-py2.7.egg\pyramid\config\__init__.py", line 11, in <module>
from pyramid.interfaces import (
File "C:\Python27\lib\site-packages\pyramid-1.5-py2.7.egg\pyramid\interfaces.py", line 1, in <module>
from zope.deprecation import deprecated
ImportError: No module named deprecation
C:\Python27>pip install zope
Downloading/unpacking zope
Could not find any downloads that satisfy the requirement zope
No distributions at all found for zope
Storing complete log in C:\Users\Tracy\pip\pip.log
C:\Python27>pip install zope.deprecation
Requirement already satisfied (use --upgrade to upgrade): zope.deprecation in c:\python27\lib\site-packages\zope.deprecation-4.1.1-py2.7.egg
Requirement already satisfied (use --upgrade to upgrade): distribute in c:\python27\lib\site-packages\distribute-0.6.26-py2.7.egg (from zope.deprecation)
Cleaning up...
C:\Python27>pip install zope.deprecation --upgrade
Requirement already up-to-date: zope.deprecation in c:\python27\lib\site-packages\zope.deprecation-4.1.1-py2.7.egg
Downloading/unpacking distribute from https://pypi.python.org/packages/source/d/distribute/distribute-0.7.3.zip#md5=c6c59594a7b180af57af8a0cc0cf5b4a (from zope.deprecation)
Downloading distribute-0.7.3.zip (145kB): 145kB downloaded
Running setup.py egg_info for package distribute
Downloading/unpacking setuptools>=0.7 (from distribute->zope.deprecation)
Downloading setuptools-3.4.4.tar.gz (794kB): 794kB downloaded
Running setup.py egg_info for package setuptools
Installing collected packages: distribute, setuptools
Found existing installation: distribute 0.6.26
Uninstalling distribute:
Successfully uninstalled distribute
Running setup.py install for distribute
Found existing installation: distribute 0.6.26
Can't uninstall 'distribute'. No files were found to uninstall.
Running setup.py install for setuptools
Installing easy_install-script.py script to C:\Python27\Scripts
Installing easy_install.exe script to C:\Python27\Scripts
Installing easy_install.exe.manifest script to C:\Python27\Scripts
Installing easy_install-2.7-script.py script to C:\Python27\Scripts
Installing easy_install-2.7.exe script to C:\Python27\Scripts
Installing easy_install-2.7.exe.manifest script to C:\Python27\Scripts
Successfully installed distribute setuptools
Cleaning up...
C:\Python27>python pyramid_hello.py
Traceback (most recent call last):
File "pyramid_hello.py", line 2, in <module>
from pyramid.config import Configurator
File "C:\Python27\lib\site-packages\pyramid-1.5-py2.7.egg\pyramid\config\__init__.py", line 11, in <module>
from pyramid.interfaces import (
File "C:\Python27\lib\site-packages\pyramid-1.5-py2.7.egg\pyramid\interfaces.py", line 1, in <module>
from zope.deprecation import deprecated
ImportError: No module named deprecation
C:\Python27>pip install deprecation
Downloading/unpacking deprecation
Could not find any downloads that satisfy the requirement deprecation
No distributions at all found for deprecation
Storing complete log in C:\Users\Tracy\pip\pip.log
使用virtualenv:
C:\Python27>easy_install virtualenv
Searching for virtualenv
Reading https://pypi.python.org/simple/virtualenv/
Best match: virtualenv 1.11.4
Downloading https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.11.4.tar.gz#md5=9accc2d3f0ec1da479ce2c3d1fdff06e
Processing virtualenv-1.11.4.tar.gz
Writing c:\users\tracy\appdata\local\temp\easy_install-o3mttl\virtualenv-1.11.4\setup.cfg
Running virtualenv-1.11.4\setup.py -q bdist_egg --dist-dir c:\users\tracy\appdata\local\temp\easy_install-o3mttl\virtualenv-1.11.4\egg-dist-tmp-qi3l26
warning: no previously-included files matching '*' found under directory 'docs\_templates'
warning: no previously-included files matching '*' found under directory 'docs\_build'
Adding virtualenv 1.11.4 to easy-install.pth file
Installing virtualenv-script.py script to C:\Python27\Scripts
Installing virtualenv.exe script to C:\Python27\Scripts
Installing virtualenv.exe.manifest script to C:\Python27\Scripts
Installing virtualenv-2.7-script.py script to C:\Python27\Scripts
Installing virtualenv-2.7.exe script to C:\Python27\Scripts
Installing virtualenv-2.7.exe.manifest script to C:\Python27\Scripts
Installed c:\python27\lib\site-packages\virtualenv-1.11.4-py2.7.egg
Processing dependencies for virtualenv
Finished processing dependencies for virtualenv
C:\Python27>set VENV=c:\env
C:\Python27>c:\Python27\Scripts\virtualenv %VENV%
New python executable in c:\env\Scripts\python.exe
Installing setuptools, pip...done.
C:\Python27>cd\
C:\>cd env
C:\env>%VENV%\Scripts\easy_install "pyramid==1.5"
Searching for pyramid==1.5
Reading https://pypi.python.org/simple/pyramid/
Best match: pyramid 1.5
Downloading https://pypi.python.org/packages/source/p/pyramid/pyramid-1.5.tar.gz#md5=8747658dcbab709a9c491e43d3b0d58b
Processing pyramid-1.5.tar.gz
Writing c:\users\tracy\appdata\local\temp\easy_install-_ci7js\pyramid-1.5\setup.cfg
Running pyramid-1.5\setup.py -q bdist_egg --dist-dir c:\users\tracy\appdata\local\temp\easy_install-_ci7js\pyramid-1.5\egg-dist-tmp-3di1fa
Adding pyramid 1.5 to easy-install.pth file
Installing ptweens-script.py script to c:\env\Scripts
Installing ptweens.exe script to c:\env\Scripts
Installing ptweens.exe.manifest script to c:\env\Scripts
Installing pdistreport-script.py script to c:\env\Scripts
Installing pdistreport.exe script to c:\env\Scripts
Installing pdistreport.exe.manifest script to c:\env\Scripts
Installing proutes-script.py script to c:\env\Scripts
Installing proutes.exe script to c:\env\Scripts
Installing proutes.exe.manifest script to c:\env\Scripts
Installing pshell-script.py script to c:\env\Scripts
Installing pshell.exe script to c:\env\Scripts
Installing pshell.exe.manifest script to c:\env\Scripts
Installing prequest-script.py script to c:\env\Scripts
Installing prequest.exe script to c:\env\Scripts
Installing prequest.exe.manifest script to c:\env\Scripts
Installing pviews-script.py script to c:\env\Scripts
Installing pviews.exe script to c:\env\Scripts
Installing pviews.exe.manifest script to c:\env\Scripts
Installing pcreate-script.py script to c:\env\Scripts
Installing pcreate.exe script to c:\env\Scripts
Installing pcreate.exe.manifest script to c:\env\Scripts
Installing pserve-script.py script to c:\env\Scripts
Installing pserve.exe script to c:\env\Scripts
Installing pserve.exe.manifest script to c:\env\Scripts
Installed c:\env\lib\site-packages\pyramid-1.5-py2.7.egg
Processing dependencies for pyramid==1.5
Searching for PasteDeploy>=1.5.0
Reading https://pypi.python.org/simple/PasteDeploy/
Best match: PasteDeploy 1.5.2
Downloading https://pypi.python.org/packages/source/P/PasteDeploy/PasteDeploy-1.5.2.tar.gz#md5=352b7205c78c8de4987578d19431af3b
Processing PasteDeploy-1.5.2.tar.gz
Writing c:\users\tracy\appdata\local\temp\easy_install-cfzau8\PasteDeploy-1.5.2\setup.cfg
Running PasteDeploy-1.5.2\setup.py -q bdist_egg --dist-dir c:\users\tracy\appdata\local\temp\easy_install-cfzau8\PasteDeploy-1.5.2\egg-dist-tmp-f7vrej
Adding pastedeploy 1.5.2 to easy-install.pth file
Installed c:\env\lib\site-packages\pastedeploy-1.5.2-py2.7.egg
Searching for translationstring>=0.4
Reading https://pypi.python.org/simple/translationstring/
Best match: translationstring 1.1
Downloading https://pypi.python.org/packages/source/t/translationstring/translationstring-1.1.tar.gz#md5=0979b46d8f0f852810c8ec4be5c26cf2
Processing translationstring-1.1.tar.gz
Writing c:\users\tracy\appdata\local\temp\easy_install-ekrgr1\translationstring-1.1\setup.cfg
Running translationstring-1.1\setup.py -q bdist_egg --dist-dir c:\users\tracy\appdata\local\temp\easy_install-ekrgr1\translationstring-1.1\egg-dist-tmp-o3xqh2
no previously-included directories found matching 'docs\_build'
Adding translationstring 1.1 to easy-install.pth file
Installed c:\env\lib\site-packages\translationstring-1.1-py2.7.egg
Searching for venusian>=1.0a3
Reading https://pypi.python.org/simple/venusian/
Best match: venusian 1.0a8
Downloading https://pypi.python.org/packages/source/v/venusian/venusian-1.0a8.tar.gz#md5=a1a72166fd7cccf0f30e3305e09ce5cf
Processing venusian-1.0a8.tar.gz
Writing c:\users\tracy\appdata\local\temp\easy_install-otkbse\venusian-1.0a8\setup.cfg
Running venusian-1.0a8\setup.py -q bdist_egg --dist-dir c:\users\tracy\appdata\local\temp\easy_install-otkbse\venusian-1.0a8\egg-dist-tmp-wxnee2
Adding venusian 1.0a8 to easy-install.pth file
Installed c:\env\lib\site-packages\venusian-1.0a8-py2.7.egg
Searching for zope.deprecation>=3.5.0
Reading https://pypi.python.org/simple/zope.deprecation/
Best match: zope.deprecation 4.1.1
Downloading https://pypi.python.org/packages/source/z/zope.deprecation/zope.deprecation-4.1.1.tar.gz#md5=ce261b9384066f7e13b63525778430cb
Processing zope.deprecation-4.1.1.tar.gz
Writing c:\users\tracy\appdata\local\temp\easy_install-vv7_t0\zope.deprecation-4.1.1\setup.cfg
Running zope.deprecation-4.1.1\setup.py -q bdist_egg --dist-dir c:\users\tracy\appdata\local\temp\easy_install-vv7_t0\zope.deprecation-4.1.1\egg-dist-tmp-g86gig
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
Adding zope.deprecation 4.1.1 to easy-install.pth file
Installed c:\env\lib\site-packages\zope.deprecation-4.1.1-py2.7.egg
Searching for zope.interface>=3.8.0
Reading https://pypi.python.org/simple/zope.interface/
Best match: zope.interface 4.1.1
Downloading https://pypi.python.org/packages/2.7/z/zope.interface/zope.interface-4.1.1-py2.7-win32.egg#md5=97fc757b020bb25b829f9c566d87c8c3
Processing zope.interface-4.1.1-py2.7-win32.egg
creating c:\env\lib\site-packages\zope.interface-4.1.1-py2.7-win32.egg
Extracting zope.interface-4.1.1-py2.7-win32.egg to c:\env\lib\site-packages
Adding zope.interface 4.1.1 to easy-install.pth file
Installed c:\env\lib\site-packages\zope.interface-4.1.1-py2.7-win32.egg
Searching for repoze.lru>=0.4
Reading https://pypi.python.org/simple/repoze.lru/
Best match: repoze.lru 0.6
Downloading https://pypi.python.org/packages/source/r/repoze.lru/repoze.lru-0.6.tar.gz#md5=2c3b64b17a8e18b405f55d46173e14dd
Processing repoze.lru-0.6.tar.gz
Writing c:\users\tracy\appdata\local\temp\easy_install-sbw6vu\repoze.lru-0.6\setup.cfg
Running repoze.lru-0.6\setup.py -q bdist_egg --dist-dir c:\users\tracy\appdata\local\temp\easy_install-sbw6vu\repoze.lru-0.6\egg-dist-tmp-o5ek4v
Adding repoze.lru 0.6 to easy-install.pth file
Installed c:\env\lib\site-packages\repoze.lru-0.6-py2.7.egg
Searching for WebOb>=1.3.1
Reading https://pypi.python.org/simple/WebOb/
Best match: WebOb 1.3.1
Downloading https://pypi.python.org/packages/source/W/WebOb/WebOb-1.3.1.tar.gz#md5=20918251c5726956ba8fef22d1556177
Processing WebOb-1.3.1.tar.gz
Writing c:\users\tracy\appdata\local\temp\easy_install-8x1ebc\WebOb-1.3.1\setup.cfg
Running WebOb-1.3.1\setup.py -q bdist_egg --dist-dir c:\users\tracy\appdata\local\temp\easy_install-8x1ebc\WebOb-1.3.1\egg-dist-tmp-dgnzem
no previously-included directories found matching '*.pyc'
no previously-included directories found matching '*.pyo'
Adding webob 1.3.1 to easy-install.pth file
Installed c:\env\lib\site-packages\webob-1.3.1-py2.7.egg
Finished processing dependencies for pyramid==1.5
C:\env>python pyramid_hello.py
Traceback (most recent call last):
File "pyramid_hello.py", line 2, in <module>
from pyramid.config import Configurator
File "C:\Python27\lib\site-packages\pyramid-1.5-py2.7.egg\pyramid\config\__init__.py", line 11, in <module>
from pyramid.interfaces import (
File "C:\Python27\lib\site-packages\pyramid-1.5-py2.7.egg\pyramid\interfaces.py", line 1, in <module>
from zope.deprecation import deprecated
ImportError: No module named deprecation
C:\env>
答案 0 :(得分:1)
您的上一个命令使用C:\Python27
中使用%PATH%变量可用的系统范围的python。
只需更改上一个使用
的命令即可C:\env>.\Scripts\python pyramid_hello.py
或从包含脚本的任何目录使用绝对路径来使用%VENV%python解释器运行它。
c:\scripts>%VENV%\Scripts\python pyramid_hello.py
您可能会发现激活/停用virtualenv会更方便。有经验的用户倾向于明确表示,金字塔文档通常不使用virtualenv激活。对于金字塔初学者来说,他们的第一步可能是一个好主意。只是品味问题。
答案 1 :(得分:0)
您应该关注installation instructions。说明应该可以帮助您安装运行“Hello World”所需的一切。