所以我试图在 Mac OSX El Capitan 版本 10.11.6 上使用 Homebrew 重新安装 python3,但我不断收到错误。我用来安装 python3 的命令如下:
$ brew install python3
Run Code Online (Sandbox Code Playgroud)
第一个命令似乎工作正常,没有抛出错误。
$ brew linkapps
Run Code Online (Sandbox Code Playgroud)
第二个命令会引发以下错误:
Warning: `brew linkapps` has been deprecated and will eventually be removed!
Unfortunately `brew linkapps` cannot behave nicely with e.g. Spotlight using
either aliases or symlinks and Homebrew formulae do not build "proper" `.app`
bundles that can be relocated. Instead, please consider using `brew cask` and
migrate formulae using `.app`s to casks.
Linking: /usr/local/opt/python/IDLE.app
Linking: /usr/local/opt/python/Python Launcher.app
Linking: /usr/local/opt/python3/IDLE 3.app
Linking: /usr/local/opt/python3/Python Launcher 3.app
Linking: /usr/local/opt/qt5/libexec/Assistant-qt5.app
Linking: /usr/local/opt/qt5/libexec/Designer-qt5.app
Linking: /usr/local/opt/qt5/libexec/Linguist-qt5.app
Linking: /usr/local/opt/qt5/libexec/pixeltool-qt5.app
Linking: /usr/local/opt/qt5/libexec/qdbusviewer-qt5.app
Linking: /usr/local/opt/qt5/libexec/qml-qt5.app
Linked 10 apps to /Applications
Run Code Online (Sandbox Code Playgroud)
当我尝试$ python3在终端中运行时,出现以下错误:
Failed to import the site module
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/site.py", line 73, in <module>
__boot()
File "/usr/local/lib/python2.7/site-packages/site.py", line 26, in __boot
import imp # Avoid import loop in Python >= 3.3
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 27, in <module>
import tokenize
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tokenize.py", line 33, in <module>
import re
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Run Code Online (Sandbox Code Playgroud)
想要一些关于如何解决这个问题的建议。目标是我可以按照本教程中的建议安装 python3 和 opencv3,但是我坚持使用 python3 无法正常工作。
小智 17
我通过/sf/answers/2955017761/解决了这个问题,有一个简单的unset PYTHONPATH(设置为PYTHONPATH=/usr/local/lib/python2.7/site-packages,与 python3 冲突)
| 归档时间: |
|
| 查看次数: |
9417 次 |
| 最近记录: |