繁体   English   中英

在我的Mac OS X 10.11上安装Paramiko

[英]Install Paramiko on my Mac OS X 10.11

我试图在Mac OS X 10.11上安装paramiko

须藤点安装paramiko

密码:*******

然后我得到了

The directory '/Users/bheng/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/bheng/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 paramiko
  Downloading paramiko-2.0.2-py2.py3-none-any.whl (171kB)
    100% |████████████████████████████████| 174kB 6.7MB/s 
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /Library/Python/2.7/site-packages (from paramiko)
Collecting cryptography>=1.1 (from paramiko)
  Downloading cryptography-1.5.2-cp27-cp27m-macosx_10_10_intel.whl (2.4MB)
    100% |████████████████████████████████| 2.4MB 568kB/s 
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in /Library/Python/2.7/site-packages (from cryptography>=1.1->paramiko)
Collecting setuptools>=11.3 (from cryptography>=1.1->paramiko)
  Downloading setuptools-28.0.0-py2.py3-none-any.whl (467kB)
    100% |████████████████████████████████| 471kB 2.7MB/s 
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography>=1.1->paramiko)
Collecting idna>=2.0 (from cryptography>=1.1->paramiko)
  Downloading idna-2.1-py2.py3-none-any.whl (54kB)
    100% |████████████████████████████████| 61kB 10.4MB/s 
Collecting ipaddress (from cryptography>=1.1->paramiko)
  Downloading ipaddress-1.0.17-py2-none-any.whl
Collecting enum34 (from cryptography>=1.1->paramiko)
  Downloading enum34-1.1.6-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): pycparser in /Library/Python/2.7/site-packages (from cffi>=1.4.1->cryptography>=1.1->paramiko)
Installing collected packages: setuptools, idna, ipaddress, enum34, cryptography, paramiko
  Found existing installation: setuptools 1.1.6
    Uninstalling setuptools-1.1.6:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-EMyxYY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

我做错了什么 ?

任何帮助,将不胜感激!

尝试sudo chown $(whoami) /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/然后对Python没有权限的任何目录执行相同的操作。

OSX和macOS的最新版本具有一个称为系统完整性保护的系统,这意味着某些目录没有用户权限。 这是为了防止恶意软件控制系统中心目录(例如/System/tmp的可能性。

编辑

pip install --user paramiko将库安装在用户目录下,这意味着您不会遇到权限问题。 还有其他方法可以始终如一地使用Python修复此问题,有关更多信息,请参见本文中的评论。

首先使用pip安装paramiko。 导航到终端并输入–

$ pip install paramiko 

要在用户目录下安装paramiko库,请使用以下命令

$ pip install --user paramiko

即使在此之后,如果您遇到“找不到模块”之类的错误,也可以尝试以下命令,

使用pip3安装Python 3模块。

$ sudo -H pip3 install paramiko --ignore-installed 
$ sudo -H pip install paramiko --ignore-installed

来源: https//thenucleargeeks.com/2019/08/08/installing-paramiko-in-mac/

暂无
暂无

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

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