简体   繁体   English

在Mac OS X 10.11.9上无法使用nsetools

[英]Not able to use nsetools on Mac OS X 10.11.9

I am not able to use nsetools on Mac OS X 10.11.6. 我不能够使用nsetools在Mac OS X 10.11.6。

sudo pip install nsetools
Password:
The directory '/Users/debraj/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/debraj/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting nsetools
 Downloading nsetools-1.0.5.tar.gz
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from nsetools)
Installing collected packages: nsetools
 Running setup.py install for nsetools ... done
Successfully installed nsetools-1.0.5

I tried installing nsetools without being a superuser. 我尝试以超级用户nsetools安装nsetools But it was throwing the below error:- 但这引发了以下错误:

pip install nsetools
Collecting nsetools
  Downloading nsetools-1.0.5.tar.gz
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from nsetools)
Installing collected packages: nsetools
  Running setup.py install for nsetools ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/lp/3q9_2mn51hd9s4yj_jcf3jxm0000gp/T/pip-build-nEc2HK/nsetools/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/lp/3q9_2mn51hd9s4yj_jcf3jxm0000gp/T/pip-gh3BsV-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/nsetools
    copying nsetools/__init__.py -> build/lib/nsetools
    copying nsetools/bases.py -> build/lib/nsetools
    copying nsetools/nse.py -> build/lib/nsetools
    copying nsetools/utils.py -> build/lib/nsetools
    running install_lib
    creating /Library/Python/2.7/site-packages/nsetools
    error: could not create '/Library/Python/2.7/site-packages/nsetools': Permission denied

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/lp/3q9_2mn51hd9s4yj_jcf3jxm0000gp/T/pip-build-nEc2HK/nsetools/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/lp/3q9_2mn51hd9s4yj_jcf3jxm0000gp/T/pip-gh3BsV-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/lp/3q9_2mn51hd9s4yj_jcf3jxm0000gp/T/pip-build-nEc2HK/nsetools/

On trying to use nsetools I am getting the below error:- 在尝试使用nsetools时,出现以下错误:-

python
Python 2.7.11 (default, Jan 22 2016, 16:30:50) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from nsetools import Nse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/nsetools/__init__.py", line 25, in <module>
    from .nse import Nse
  File "/Library/Python/2.7/site-packages/nsetools/nse.py", line 26, in <module>
    import six
ImportError: No module named six

Even though I have six installed:- 即使我安装了six

sudo -H pip install six
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

Can someone let me know what is going wrong? 有人可以让我知道怎么了吗?

I strongly advise you not to install pip packages with sudo , instead read about using virtual environments with Python, such as virtualenv or pyenv . 我强烈建议您不要使用sudo安装pip软件包,而是阅读有关将虚拟环境与Python结合使用的信息,例如virtualenvpyenv Without virtual environment you will constantly face errors such as the ones you mentioned. 没有虚拟环境,您将不断遇到您提到的错误。

This should help you with setting up the virtual environment: 这应该可以帮助您设置虚拟环境:

$ pip install virtualenv
$ virtualenv your_virtualenv_name
$ source your_virtualenv_name/bin/activate
(your_virtualenv_name) $ pip install nsetools

Read this article to get the idea about virtual environments, their purpose and usage. 阅读本文以了解有关虚拟环境,其用途和用途的想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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