六个不能 imported/uninstalled/reinstalled/upgraded
six cannot be imported/uninstalled/reinstalled/upgraded
我试图在我的 MacBook 终端上 运行 lldb
,但我收到与 six
包相关的错误:
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in <module>
import six
ImportError: No module named six
Traceback (most recent call last):
File "<string>", line 1, in <module>
我尝试从终端启动 python,然后执行 import six
,但仍然:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named six
下一步是卸载并重新安装 six
,但似乎与此软件包相关的所有内容对我来说都已损坏:
$: pip uninstall six
Uninstalling six:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/uninstall.py", line 59, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1035, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 598, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1836, in remove
renames(path, new_path)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/util.py", line 295, in renames
shutil.move(old, new)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/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/_c/lj7t1035563flfh7fy4m3gfh0000gn/T/pip-YQdNMp-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Storing debug log for failure in /Users/lab5/.pip/pip.log
$: pip install --ignore-installed six
Downloading/unpacking six
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement six
Cleaning up...
No distributions at all found for six
Storing debug log for failure in /Users/lab5/.pip/pip.log
我下载了 six
并从 tar.gz 文件安装了它,但似乎仍然安装了旧版本:
$: pip install --ignore-installed ~/Downloads/six-1.5.1.tar.gz
Unpacking ./Downloads/six-1.5.1.tar.gz
Running setup.py (path:/var/folders/_c/lj7t1035563flfh7fy4m3gfh0000gn/T/pip-zqLhAa-build/setup.py) egg_info for package from file:///Users/lab5/Downloads/six-1.5.1.tar.gz
no previously-included directories found matching 'documentation/_build'
Installing collected packages: six
Running setup.py install for six
no previously-included directories found matching 'documentation/_build'
Successfully installed six
Cleaning up...
$: pip show six
---
Name: six
Version: 1.4.1
Location: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requires:
Python version: Python 2.7.15
Pip version: pip 1.5.6 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)
您对如何消除这些错误和 运行 lldb
有什么建议吗?我采纳了某人的建议重新安装 python(简单地 brew install python
),但没有帮助。
您正在使用 python2,要使用 brew 安装 python2 您需要添加 @2
brew install python@2
我用的是python2用brew装的,能装6个就好了。从你的错误来看,当你尝试 pip install six
时,你会得到 OSError: [Errno 1] Operation not permitted:
用 sudo -H
尝试 运行 点
sudo -H pip install six --upgrade
我仍然不确定错误的原因是什么,但我可以在升级我的 python 版本后摆脱它们,我对此很好。
要安装新的 python 版本:
brew install python
然后,我删除了 /usr/local/bin/python
处的 link 并将其重新设置为新版本:
rm /usr/local/bin/python
ln -s /usr/local/Cellar/python/3.7.0/bin/python3.7 /usr/local/bin/python
然后,使用新版本的 pip 安装 six
:
python -m pip install six
(执行 python -m
强制使用新的 pip 安装,对于新的 python)
我对那个解决方案不是 100% 满意,我仍然必须删除旧版本才能进行干净的 python 安装,但至少我现在可以使用 lldb
,这是我的主要目标
使用 xcode-select -switch
指向正确的 Xcode 安装为我解决了这个问题。
我试图在我的 MacBook 终端上 运行 lldb
,但我收到与 six
包相关的错误:
File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in <module>
import six
ImportError: No module named six
Traceback (most recent call last):
File "<string>", line 1, in <module>
我尝试从终端启动 python,然后执行 import six
,但仍然:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named six
下一步是卸载并重新安装 six
,但似乎与此软件包相关的所有内容对我来说都已损坏:
$: pip uninstall six
Uninstalling six:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/uninstall.py", line 59, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1035, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 598, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req.py", line 1836, in remove
renames(path, new_path)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/util.py", line 295, in renames
shutil.move(old, new)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/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/_c/lj7t1035563flfh7fy4m3gfh0000gn/T/pip-YQdNMp-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Storing debug log for failure in /Users/lab5/.pip/pip.log
$: pip install --ignore-installed six
Downloading/unpacking six
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement six
Cleaning up...
No distributions at all found for six
Storing debug log for failure in /Users/lab5/.pip/pip.log
我下载了 six
并从 tar.gz 文件安装了它,但似乎仍然安装了旧版本:
$: pip install --ignore-installed ~/Downloads/six-1.5.1.tar.gz
Unpacking ./Downloads/six-1.5.1.tar.gz
Running setup.py (path:/var/folders/_c/lj7t1035563flfh7fy4m3gfh0000gn/T/pip-zqLhAa-build/setup.py) egg_info for package from file:///Users/lab5/Downloads/six-1.5.1.tar.gz
no previously-included directories found matching 'documentation/_build'
Installing collected packages: six
Running setup.py install for six
no previously-included directories found matching 'documentation/_build'
Successfully installed six
Cleaning up...
$: pip show six
---
Name: six
Version: 1.4.1
Location: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requires:
Python version: Python 2.7.15
Pip version: pip 1.5.6 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)
您对如何消除这些错误和 运行 lldb
有什么建议吗?我采纳了某人的建议重新安装 python(简单地 brew install python
),但没有帮助。
您正在使用 python2,要使用 brew 安装 python2 您需要添加 @2
brew install python@2
我用的是python2用brew装的,能装6个就好了。从你的错误来看,当你尝试 pip install six
时,你会得到 OSError: [Errno 1] Operation not permitted:
用 sudo -H
sudo -H pip install six --upgrade
我仍然不确定错误的原因是什么,但我可以在升级我的 python 版本后摆脱它们,我对此很好。
要安装新的 python 版本:
brew install python
然后,我删除了 /usr/local/bin/python
处的 link 并将其重新设置为新版本:
rm /usr/local/bin/python
ln -s /usr/local/Cellar/python/3.7.0/bin/python3.7 /usr/local/bin/python
然后,使用新版本的 pip 安装 six
:
python -m pip install six
(执行 python -m
强制使用新的 pip 安装,对于新的 python)
我对那个解决方案不是 100% 满意,我仍然必须删除旧版本才能进行干净的 python 安装,但至少我现在可以使用 lldb
,这是我的主要目标
使用 xcode-select -switch
指向正确的 Xcode 安装为我解决了这个问题。