Pip install wechatpy error, pipwechatpy
Install the python WeChat sdk
pip install wechatpy[cryptography]
Error
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'
In usepip install
This error occurs when installing some python packages because these packages depend on six. When installing six, we find that the system already has a six-1.4.1 but has no permission to uninstall it, therefore, the new version cannot be installed. Six-1.4.1 is the system's built-in packages, becauseSystem integration ProtectionYou have no permission to modify the/System/Library/Frameworks/Python. framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info directory.
The solution is to ignore six installation when installing these packages:
sudo pip install wechatpy[cryptography] --upgrade --ignore-installed six
An error is reported later.
Installing collected packages: six, python-dateutil, xmltodict, enum34, optionaldict, idna, urllib3, certifi, chardet, requests, pycparser, cffi, asn1crypto, ipaddress, cryptography, wechatpyException: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'
Permission issues, try
sudo pip install wechatpy[cryptography] --upgrade --ignore-installed six
Reference:
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