简体   繁体   中英

Pip not installing nose package

First off, let me say I'm a newbie to the Unix command line, so forgive me if anything sounds naive. I've installed pip on my machine and I'm trying to use it to install nose. I have a nose zip file in my downloads folder and I'm trying to install it into my sitepackages directory so I can begin using it for unit testing. In terminal, I typed in pip install nose and got what you see below.Any idea what's going on here? Do I need to use sudo or does the nose zip file need to be placed in another directory to be accessed by pip perhaps?...

Downloading/unpacking nose
Downloading nose-1.3.0.tar.gz (404kB): 404kB downloaded
Running setup.py egg_info for package nose

    no previously-included directories found matching 'doc/.build'
Installing collected packages: nose
Running setup.py install for nose
error: could not create '/Library/Python/2.7/site-packages/nose': Permission denied
Complete output from command /usr/bin/python -c "import setuptools;__file__='/private/var/folders/yy/4vm2zy7j5_s32zv4rwdhn5500000gn/T/pip-build-mikaschiller/nose/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/yy/4vm2zy7j5_s32zv4rwdhn5500000gn/T/pip-YKue2u-record/install-record.txt --single-version-externally-managed:
running install

running build

running build_py

creating build

creating build/lib

creating build/lib/nose

copying nose/__init__.py -> build/lib/nose

copying nose/__main__.py -> build/lib/nose

copying nose/case.py -> build/lib/nose

copying nose/commands.py -> build/lib/nose

copying nose/config.py -> build/lib/nose

copying nose/core.py -> build/lib/nose

copying nose/exc.py -> build/lib/nose

copying nose/failure.py -> build/lib/nose

copying nose/importer.py -> build/lib/nose

copying nose/inspector.py -> build/lib/nose

copying nose/loader.py -> build/lib/nose

copying nose/proxy.py -> build/lib/nose

copying nose/pyversion.py -> build/lib/nose

copying nose/result.py -> build/lib/nose

copying nose/selector.py -> build/lib/nose

copying nose/suite.py -> build/lib/nose

copying nose/twistedtools.py -> build/lib/nose

copying nose/util.py -> build/lib/nose

creating build/lib/nose/ext

copying nose/ext/__init__.py -> build/lib/nose/ext

copying nose/ext/dtcompat.py -> build/lib/nose/ext

creating build/lib/nose/plugins

copying nose/plugins/__init__.py -> build/lib/nose/plugins

copying nose/plugins/allmodules.py -> build/lib/nose/plugins

copying nose/plugins/attrib.py -> build/lib/nose/plugins

copying nose/plugins/base.py -> build/lib/nose/plugins

copying nose/plugins/builtin.py -> build/lib/nose/plugins

copying nose/plugins/capture.py -> build/lib/nose/plugins

copying nose/plugins/collect.py -> build/lib/nose/plugins

copying nose/plugins/cover.py -> build/lib/nose/plugins

copying nose/plugins/debug.py -> build/lib/nose/plugins

copying nose/plugins/deprecated.py -> build/lib/nose/plugins

copying nose/plugins/doctests.py -> build/lib/nose/plugins

copying nose/plugins/errorclass.py -> build/lib/nose/plugins

copying nose/plugins/failuredetail.py -> build/lib/nose/plugins

copying nose/plugins/isolate.py -> build/lib/nose/plugins

copying nose/plugins/logcapture.py -> build/lib/nose/plugins

copying nose/plugins/manager.py -> build/lib/nose/plugins

copying nose/plugins/multiprocess.py -> build/lib/nose/plugins

copying nose/plugins/plugintest.py -> build/lib/nose/plugins

copying nose/plugins/prof.py -> build/lib/nose/plugins

copying nose/plugins/skip.py -> build/lib/nose/plugins

copying nose/plugins/testid.py -> build/lib/nose/plugins

copying nose/plugins/xunit.py -> build/lib/nose/plugins

creating build/lib/nose/sphinx

copying nose/sphinx/__init__.py -> build/lib/nose/sphinx

copying nose/sphinx/pluginopts.py -> build/lib/nose/sphinx

creating build/lib/nose/tools

copying nose/tools/__init__.py -> build/lib/nose/tools

copying nose/tools/nontrivial.py -> build/lib/nose/tools

copying nose/tools/trivial.py -> build/lib/nose/tools

copying nose/usage.txt -> build/lib/nose

running install_lib

creating /Library/Python/2.7/site-packages/nose

error: could not create '/Library/Python/2.7/site-packages/nose': Permission denied

您需要使用sudo pip install nosesudo

You are trying to install nose globally without having the necessary permissions.

You can either use sudo pip install nose , or, preferably, use virtual environments ( https://virtualenv.readthedocs.org/en/latest/ ) for your development. With those, you can install and remove things without root permissions, you cannot mess up your global setup and you can use different versions of libraries within different projects you are working on.

If you try virtual environments, also take a look at virtualenvwrapper , that helps a lot in keeping them organized.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM