zoukankan      html  css  js  c++  java
  • pip install wechatpy报错

    安装python 版WeChat sdk

    pip install wechatpy[cryptography]

    报错

    Found existing installation: six 1.4.1
        DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
        Uninstalling six-1.4.1:
    Exception:
    Traceback (most recent call last):
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
        prefix=options.prefix_path,
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
        requirement.uninstall(auto_confirm=True)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
        paths_to_remove.remove(auto_confirm)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
        renames(path, new_path)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/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 302, in move
        copy2(src, real_dst)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
        copystat(src, dst)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
        os.chflags(dst, st.st_flags)
    OSError: [Errno 1] Operation not permitted: '/var/folders/k2/x01hrj4552l0746g8fxdk5400000gn/T/pip-0E52Fq-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

    在用pip install安装python的一些包的时候遇到这个错误是因为这些包需要依赖six,在安装six的时候发现系统已经有一个six-1.4.1但又没有权限卸载它,所以无法安装新版本。six-1.4.1是系统内置的packages,因 系统集成保护 你是没有权限去修改/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info目录的。

    解决方法是安装这些包时选择忽略six的安装:

    sudo pip install wechatpy[cryptography] --upgrade --ignore-installed six

    之后发现还是报错

    Installing collected packages: six, python-dateutil, xmltodict, enum34, optionaldict, idna, urllib3, certifi, chardet, requests, pycparser, cffi, asn1crypto, ipaddress, cryptography, wechatpy
    Exception:
    Traceback (most recent call last):
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
        prefix=options.prefix_path,
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
        **kwargs
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
        self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
        isolated=self.isolated,
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
        clobber(source, lib_dir, True)
      File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 323, in clobber
        shutil.copyfile(srcfile, destfile)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
        with open(dst, 'wb') as fdst:
    IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/six.py'

    权限问题,尝试

    sudo pip install wechatpy[cryptography] --upgrade --ignore-installed six

    参考文档:

    http://wechatpy.readthedocs.io/zh_CN/master/install.html

    http://www.cnblogs.com/chxw2017/p/6837100.html

    http://blog.csdn.net/alanzjl/article/details/46849307

    -------------------------------- 2017-11-08 更新 ---------------------------------------.

    python安装第三方库超时

    例如:

    pip install python-weixin 报错如下
    ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

    解决:

    pip --default-timeout=100 -U python-weixin

    另外遇到 OSError: [Errno 13] Permission denied:这种权限问题可以尝试sudo
  • 相关阅读:
    场景法设计测试用例
    编写边界条件测试用例原则
    CSS
    JavaScript
    HTML
    lamp安装教程
    Linux(lamp安装)
    oracle sqlplus常用命令
    利用同步器实现互斥锁
    工厂模式--简单工厂模式
  • 原文地址:https://www.cnblogs.com/xs514521/p/7770842.html
Copyright © 2011-2022 走看看