在Mac上安装Pyramid和Distribute

时间:2012-08-16 02:02:59

标签: python macos install pyramid distribute

Last login: Wed Aug 15 18:31:40 on console
unknown68a86d4e0c2c:~ pessimisticoptimism$ curl -O http://python-distribute.org/distribute_setup.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16295  100 16295    0     0   3389      0  0:00:04  0:00:04 --:--:--  5813
unknown68a86d4e0c2c:~ pessimisticoptimism$ python distribute_setup.py
Downloading #
Extracting in /var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0
Now working in /var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28
Installing Distribute
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Non-egg installation
Removing elements out of the way...
Renaming /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools-0.6c12dev_r85381-py2.7.egg-info into /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools-0.6c12dev_r85381-py2.7.egg-info.OLD.1345081179.88
Traceback (most recent call last):
  File "setup.py", line 131, in <module>
    _before_install()
  File "/private/var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28/distribute_setup.py", line 363, in _before_install
    _fake_setuptools()
  File "/private/var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28/distribute_setup.py", line 420, in _fake_setuptools
    res = _remove_flat_installation(setuptools_location)
  File "/private/var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28/distribute_setup.py", line 224, in __no_sandbox
    return function(*args, **kw)
  File "/private/var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28/distribute_setup.py", line 279, in _remove_flat_installation
    patched = _patch_egg_dir(pkg_info)
  File "/private/var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28/distribute_setup.py", line 224, in __no_sandbox
    return function(*args, **kw)
  File "/private/var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28/distribute_setup.py", line 347, in _patch_egg_dir
    _rename_path(path)
  File "/private/var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpqkrkH0/distribute-0.6.28/distribute_setup.py", line 259, in _rename_path
    os.rename(path, new_name)
OSError: [Errno 13] Permission denied
Something went wrong during the installation.
See the error message above.
unknown68a86d4e0c2c:~ pessimisticoptimism$ python3 distribute_setup.py
Extracting in /var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpdpzzpn
Now working in /var/folders/nf/kkw6hklx1zd2kpcmq5xvrxqw0000gn/T/tmpdpzzpn/distribute-0.6.28
Installing Distribute
creating build
creating build/src
creating build/src/docs
creating build/src/docs/_templates
creating build/src/docs/_theme
creating build/src/docs/_theme/nature
creating build/src/docs/_theme/nature/static
creating build/src/docs/build
creating build/src/docs/build/html
creating build/src/docs/build/html/_sources
creating build/src/docs/build/html/_static
creating build/src/setuptools
creating build/src/setuptools/command
creating build/src/setuptools/tests
creating build/src/setuptools/tests/indexes
creating build/src/setuptools/tests/indexes/test_links_priority
creating build/src/setuptools/tests/indexes/test_links_priority/simple
creating build/src/setuptools/tests/indexes/test_links_priority/simple/foobar
creating build/src/tests
creating build/src/tests/python3.3_bdist_egg_test
creating build/src/tests/shlib_test
copying setuptools/__init__.py -> build/src/setuptools
copying setuptools/archive_util.py -> build/src/setuptools
copying setuptools/depends.py -> build/src/setuptools
copying setuptools/dist.py -> build/src/setuptools
copying setuptools/extension.py -> build/src/setuptools
copying setuptools/package_index.py -> build/src/setuptools
copying setuptools/sandbox.py -> build/src/setuptools
copying setuptools/script template (dev).py -> build/src/setuptools
copying setuptools/script template.py -> build/src/setuptools
copying setuptools/tests/__init__.py -> build/src/setuptools/tests
copying setuptools/tests/doctest.py -> build/src/setuptools/tests
copying setuptools/tests/py26compat.py -> build/src/setuptools/tests
copying setuptools/tests/server.py -> build/src/setuptools/tests
copying setuptools/tests/test_bdist_egg.py -> build/src/setuptools/tests
copying setuptools/tests/test_build_ext.py -> build/src/setuptools/tests
copying setuptools/tests/test_develop.py -> build/src/setuptools/tests
copying setuptools/tests/test_dist_info.py -> build/src/setuptools/tests
copying setuptools/tests/test_easy_install.py -> build/src/setuptools/tests
copying setuptools/tests/test_packageindex.py -> build/src/setuptools/tests
copying setuptools/tests/test_resources.py -> build/src/setuptools/tests
copying setuptools/tests/test_sandbox.py -> build/src/setuptools/tests
copying setuptools/tests/test_upload_docs.py -> build/src/setuptools/tests
copying setuptools/command/__init__.py -> build/src/setuptools/command
copying setuptools/command/alias.py -> build/src/setuptools/command
copying setuptools/command/bdist_egg.py -> build/src/setuptools/command
copying setuptools/command/bdist_rpm.py -> build/src/setuptools/command
copying setuptools/command/bdist_wininst.py -> build/src/setuptools/command
copying setuptools/command/build_ext.py -> build/src/setuptools/command
copying setuptools/command/build_py.py -> build/src/setuptools/command
copying setuptools/command/develop.py -> build/src/setuptools/command
copying setuptools/command/easy_install.py -> build/src/setuptools/command
copying setuptools/command/egg_info.py -> build/src/setuptools/command
copying setuptools/command/install.py -> build/src/setuptools/command
copying setuptools/command/install_egg_info.py -> build/src/setuptools/command
copying setuptools/command/install_lib.py -> build/src/setuptools/command
copying setuptools/command/install_scripts.py -> build/src/setuptools/command
copying setuptools/command/register.py -> build/src/setuptools/command
copying setuptools/command/rotate.py -> build/src/setuptools/command
copying setuptools/command/saveopts.py -> build/src/setuptools/command
copying setuptools/command/sdist.py -> build/src/setuptools/command
copying setuptools/command/setopt.py -> build/src/setuptools/command
copying setuptools/command/test.py -> build/src/setuptools/command
copying setuptools/command/upload.py -> build/src/setuptools/command
copying setuptools/command/upload_docs.py -> build/src/setuptools/command
copying setuptools/tests/win_script_wrapper.txt -> build/src/setuptools/tests
copying setuptools/cli-32.exe -> build/src/setuptools
copying setuptools/cli-64.exe -> build/src/setuptools
copying setuptools/cli.exe -> build/src/setuptools
copying setuptools/gui-32.exe -> build/src/setuptools
copying setuptools/gui-64.exe -> build/src/setuptools
copying setuptools/gui.exe -> build/src/setuptools
copying tests/install_test.py -> build/src/tests
copying tests/manual_test.py -> build/src/tests
copying tests/test_distribute_setup.py -> build/src/tests
copying tests/test_python33_bdist_egg.py -> build/src/tests
copying tests/shlib_test/setup.py -> build/src/tests/shlib_test
copying tests/shlib_test/test_hello.py -> build/src/tests/shlib_test
copying tests/python3.3_bdist_egg_test/module.py -> build/src/tests/python3.3_bdist_egg_test
copying tests/python3.3_bdist_egg_test/setup.py -> build/src/tests/python3.3_bdist_egg_test
copying tests/shlib_test/hello.c -> build/src/tests/shlib_test
copying tests/shlib_test/hellolib.c -> build/src/tests/shlib_test
copying tests/shlib_test/hello.pyx -> build/src/tests/shlib_test
copying tests/api_tests.txt -> build/src/tests
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored build/src/tests/api_tests.txt
--- build/src/tests/api_tests.txt   (original)
+++ build/src/tests/api_tests.txt   (refactored)
@@ -39,7 +39,7 @@
     >>> dist.py_version == sys.version[:3]
     True

-    >>> print dist.platform
+    >>> print(dist.platform)
     None

 Including various computed attributes::
@@ -199,7 +199,7 @@
 You can ask a WorkingSet to ``find()`` a distribution matching a requirement::

     >>> from pkg_resources import Requirement
-    >>> print ws.find(Requirement.parse("Foo==1.0"))    # no match, return None
+    >>> print(ws.find(Requirement.parse("Foo==1.0")))    # no match, return None
     None

     >>> ws.find(Requirement.parse("Bar==0.9"))  # match, return distribution
@@ -211,7 +211,7 @@
     >>> try:
     ...     ws.find(Requirement.parse("Bar==1.0"))
     ... except VersionConflict:
-    ...     print 'ok'
+    ...     print('ok')
     ok

 You can subscribe a callback function to receive notifications whenever a new
@@ -219,7 +219,7 @@
 once for each existing distribution in the working set, and then is called
 again for new distributions added thereafter::

-    >>> def added(dist): print "Added", dist
+    >>> def added(dist): print("Added", dist)
     >>> ws.subscribe(added)
     Added Bar 0.9
     >>> foo12 = Distribution(project_name="Foo", version="1.2", location="f12") 
RefactoringTool: Files that were modified:
RefactoringTool: build/src/tests/api_tests.txt
copying setuptools/tests/indexes/test_links_priority/external.html -> build/src/setuptools/tests/indexes/test_links_priority
copying setuptools/tests/indexes/test_links_priority/simple/foobar/index.html -> build/src/setuptools/tests/indexes/test_links_priority/simple/foobar
copying docs/conf.py -> build/src/docs
copying docs/easy_install.txt -> build/src/docs
copying docs/index.txt -> build/src/docs
copying docs/pkg_resources.txt -> build/src/docs
copying docs/python3.txt -> build/src/docs
copying docs/roadmap.txt -> build/src/docs
copying docs/setuptools.txt -> build/src/docs
copying docs/using.txt -> build/src/docs
copying docs/build/html/_sources/easy_install.txt -> build/src/docs/build/html/_sources
copying docs/build/html/_sources/index.txt -> build/src/docs/build/html/_sources
copying docs/build/html/_sources/pkg_resources.txt -> build/src/docs/build/html/_sources
copying docs/build/html/_sources/python3.txt -> build/src/docs/build/html/_sources
copying docs/build/html/_sources/roadmap.txt -> build/src/docs/build/html/_sources
copying docs/build/html/_sources/setuptools.txt -> build/src/docs/build/html/_sources
copying docs/build/html/_sources/using.txt -> build/src/docs/build/html/_sources
copying docs/_theme/nature/theme.conf -> build/src/docs/_theme/nature
copying docs/build/html/_static/basic.css -> build/src/docs/build/html/_static
copying docs/build/html/_static/nature.css -> build/src/docs/build/html/_static
copying docs/build/html/_static/pygments.css -> build/src/docs/build/html/_static
copying docs/_theme/nature/static/pygments.css -> build/src/docs/_theme/nature/static
copying docs/_theme/nature/static/nature.css_t -> build/src/docs/_theme/nature/static
copying docs/Makefile -> build/src/docs
copying docs/_templates/indexsidebar.html -> build/src/docs/_templates
copying distribute_setup.py -> build/src
copying easy_install.py -> build/src
copying pkg_resources.py -> build/src
copying release.py -> build/src
copying setup.py -> build/src
copying site.py -> build/src
copying CHANGES.txt -> build/src
copying CONTRIBUTORS.txt -> build/src
copying DEVGUIDE.txt -> build/src
copying README.txt -> build/src
copying MANIFEST.in -> build/src
copying launcher.c -> build/src
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages
Non-egg installation
Removing elements out of the way...
Already patched.
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/setuptools-0.6c11-py3.2.egg-info already patched.
running install
running bdist_egg
running egg_info
writing distribute.egg-info/PKG-INFO
writing top-level names to distribute.egg-info/top_level.txt
writing dependency_links to distribute.egg-info/dependency_links.txt
writing entry points to distribute.egg-info/entry_points.txt
reading manifest file 'distribute.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'distribute.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-intel/egg
running install_lib
running build_py
creating build/lib
copying build/src/pkg_resources.py -> build/lib
copying build/src/easy_install.py -> build/lib
copying build/src/site.py -> build/lib
creating build/lib/setuptools
#
copying build/lib/site.py -> build/bdist.macosx-10.6-intel/egg
byte-compiling build/bdist.macosx-10.6-intel/egg/easy_install.py to easy_install.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/pkg_resources.py to pkg_resources.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/__init__.py to __init__.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/archive_util.py to archive_util.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/__init__.py to __init__.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/alias.py to alias.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/bdist_egg.py to bdist_egg.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/bdist_rpm.py to bdist_rpm.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/bdist_wininst.py to bdist_wininst.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/build_ext.py to build_ext.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/build_py.py to build_py.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/develop.py to develop.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/easy_install.py to easy_install.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/egg_info.py to egg_info.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/install.py to install.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/install_egg_info.py to install_egg_info.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/install_lib.py to install_lib.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/install_scripts.py to install_scripts.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/register.py to register.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/rotate.py to rotate.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/saveopts.py to saveopts.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/sdist.py to sdist.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/setopt.py to setopt.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/test.py to test.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/upload.py to upload.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/command/upload_docs.py to upload_docs.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/depends.py to depends.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/dist.py to dist.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/extension.py to extension.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/package_index.py to package_index.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/sandbox.py to sandbox.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/script template (dev).py to script template (dev).cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/script template.py to script template.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/__init__.py to __init__.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/doctest.py to doctest.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/py26compat.py to py26compat.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/server.py to server.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_bdist_egg.py to test_bdist_egg.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_build_ext.py to test_build_ext.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_develop.py to test_develop.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_dist_info.py to test_dist_info.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_easy_install.py to test_easy_install.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_packageindex.py to test_packageindex.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_resources.py to test_resources.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_sandbox.py to test_sandbox.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/setuptools/tests/test_upload_docs.py to test_upload_docs.cpython-32.pyc
byte-compiling build/bdist.macosx-10.6-intel/egg/site.py to site.cpython-32.pyc
creating build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying distribute.egg-info/PKG-INFO -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying distribute.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying distribute.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying distribute.egg-info/entry_points.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying distribute.egg-info/top_level.txt -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
copying distribute.egg-info/zip-safe -> build/bdist.macosx-10.6-intel/egg/EGG-INFO
creating dist
creating 'dist/distribute-0.6.28-py3.2.egg' and adding 'build/bdist.macosx-10.6-intel/egg' to it
removing 'build/bdist.macosx-10.6-intel/egg' (and everything under it)
Processing distribute-0.6.28-py3.2.egg
creating /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg
Extracting distribute-0.6.28-py3.2.egg to /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages
Removing distribute 0.6.27 from easy-install.pth file
Adding distribute 0.6.28 to easy-install.pth file
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/3.2/bin
Installing easy_install-3.2 script to /Library/Frameworks/Python.framework/Versions/3.2/bin

Installed /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/distribute-0.6.28-py3.2.egg
Processing dependencies for distribute==0.6.28
Finished processing dependencies for distribute==0.6.28
After install bootstrap.
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/setuptools-0.6c11-py3.2.egg-info already exists

unknown68a86d4e0c2c:~ pessimisticoptimism$ easy_install pip
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-414.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  #

Please make the appropriate changes for your system and try again.

unknown68a86d4e0c2c:~ pessimisticoptimism$ pip install distribute
-bash: pip: command not found
unknown68a86d4e0c2c:~ pessimisticoptimism$ pip -U pyramid
-bash: pip: command not found
unknown68a86d4e0c2c:~ pessimisticoptimism$

以上是我尝试在Mac OS X Lion上安装Distribute和Pyramid。它不起作用,所以任何输入都会受到赞赏!

3 个答案:

答案 0 :(得分:5)

一个月前,这对我来说都是一个很大的谜 - 我只是要全力以赴,原谅我的冗长:

使用python setup.py(或类似)进行安装时,安装到系统范围内(即可供计算机上的所有用户使用)。与安装应用程序类似,它需要(管理员)权限。使用sudo的预挂起命令是您使用管理员权限从命令行安装的方法。

正如所说的那样 - 正如D.Shawley(以及其他许多人)指出的那样,现在常见的做法是使用virtualenv。这允许python安装独立于系统 - 您可以安装/更改各种事情而不会搞砸您的系统。

以下是我如何使用virtualenv设置金字塔(干净安装) Mountain Lion
(首先需要安装XCode Command Linen Tools - 需要开发者ID)

george$ sudo easy_install pip
george$ sudo pip install virtualenv
george$ sudo pip install virtualenvwrapper

使用virtualenv在您选择的目录中创建virtualenv。下面,我创建一个名为Projects的目录,更改为它,然后创建我的virtualenv并将其命名为金字塔。

george$ mkdir ~/Projects
george$ cd ~/Projects
george$ virtualenv myVirtualenv        -- this just creates the environment.
george$ cd myVirtualenv                -- change into the directory
george$ ls                        -- list contents of the direcotry

安装后ls的输出应显示3个文件夹:binincludelib。 virtualenv将必要的工具放在此目录的bin文件夹中,包括pippython。因此,在此文件夹中工作时,请始终参考这些目录中的版本。

不正确: pip install pyramid
正确: bin/pip install pyramid

运行bin/pip install pyramid会在你的virtualenv中安装金字塔。重新运行相同的命令,将pyramid替换为您需要安装的任何其他命令。

答案 1 :(得分:2)

您可以将其作为sudo pip install distribute运行,也可以先创建virtualenv,激活它,然后再运行这些命令。

答案 2 :(得分:1)

我建议将其安装到虚拟环境中。首先使用 easy_install 安装virtualenv。这是您应该在全局环境中安装的唯一内容。您必须sudo才能安装它。

unknown68a86d4e0c2c:~ sudo easy_install virtualenv
Password:
.... lots of output here ....
Installing virtualenv script to /usr/local/bin
Installing virtualenv-2.7 script to /usr/local/bin

Using /Library/Python/2.7/site-packages/virtualenv-1.7.2-py2.7.egg
Processing dependencies for virtualenv
Finished processing dependencies for virtualenv
unknown68a86d4e0c2c:~ which virtualenv
/usr/local/bin/virtualenv
unknown68a86d4e0c2c:~ virtualenv --no-site-packages pyramid
The --no-site-packages flag is deprecated; it is now the default behavior.
New python executable in pyramid/bin/python
Installing setuptools............done
unknown68a86d4e0c2c:~ cd pyramid
unknown68a86d4e0c2c:pyramid source bin/activate
(pyramid)unknown68a86d4e0c2c:pyramid which pip
/Users/unknown68a86d4e0c2c/pyramid/bin/pip
(pyramid)unknown68a86d4e0c2c:pyramid pip install pyramid
Downloading/unpacking pyramid
  Downloading pyramid-1.3.3.tar.gz (2.4Mb): 2.4Mb downloaded
  Running setup.py egg_info for package pyramid
.... lots of output ....
Successfully installed pyramid Chameleon Mako WebOb repoze.lru zope.interface 
zope.deprecation venusian translationstring PasteDeploy MarkupSafe
Cleaning up...
(pyramid)unknown68a86d4e0c2c:pyramid which pserve
/Users/unknown68a86d4e0c2c/pyramid/bin/pserve

一旦你习惯用virtualenv进行开发,你将永远不会理解没有它你做了什么。金字塔教程是我第一次使用virtualenv - the setup section of the tutorial covers it briefly