MacOSX问题:ImportError: No module named ‘_scproxy’

作者: xusx 分类: Python 发布时间: 2019-11-10 13:40 浏览:575

问题:

Mac下安装Python对版本管理软件PyEnv后,再安装某个版本的Python市遇到下面报错信息。

pyenv install 3.5.7
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.5.7.tar.xz…
-> https://www.python.org/ftp/python/3.5.7/Python-3.5.7.tar.xz
Installing Python-3.5.7…
python-build: use readline from homebrew
BUILD FAILED (OS X 10.14.6 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/g5/y2s0vp1506g5ybtgk5wz8l4r0000gn/T/python-build.20191110124944.46811
Results logged to /var/folders/g5/y2s0vp1506g5ybtgk5wz8l4r0000gn/T/python-build.20191110124944.46811.log
Last 4 log lines:
File "/private/var/folders/g5/y2s0vp1506g5ybtgk5wz8l4r0000gn/T/python-build.20191110124944.46811/Python-3.5.7/Lib/urllib/request.py", line 2521, in
from _scproxy import _get_proxy_settings, _get_proxies
ImportError: No module named '_scproxy'
make: *** [install] Error 1

解决:

执行下面命令可以安装指定版本的Python。

SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk MACOSX_DEPLOYMENT_TARGET=10.14 pyenv install 3.7.3

相关文章:

1、Mac下使用pyenv安装、管理多个Python版本

2、Python虚拟环境virtualenv的安装和使用

参考:

1、https://stackoverflow.com/questions/51551557/pyenv-build-failed-installing-python-on-macos

2、https://stackoverflow.com/questions/5647023/no-module-named-scproxy-on-osx

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注