MacOS Python 3.7 使用pip3安装时遇到的错误及解决方法
"在MacBook上使用pip3安装软件包时遇到了警告和错误,提示关于弃用的功能,以及安装选项可能导致的行为不确定性。错误指出位置更改的选项在--install-option中找到,这种配置不受支持,并将在pip 20.2版本中移除。建议使用如--user、--prefix、--root和--target等pip级别的选项作为替代。同时,报错还提到了一个具体的命令行执行路径,以及在尝试安装特定版本的setuptools、wheel和Cython时遇到了退出状态为1的错误。" 在MacBook上使用pip3进行Python软件包管理时,可能会遇到各种问题,尤其是在更新或安装过程中。在这个案例中,存在以下几个关键知识点: 1. **UserWarning**: 这是一个警告,表示在使用`--build-option`、`--global-option`或`--install-option`时禁用了所有轮子(whl)的使用。轮子是预先编译的Python包,可以提高安装速度。如果禁用轮子,可能会导致安装过程变慢。 2. **DEPRECATION**: 这个错误消息指出,使用`--install-option`中的位置更改选项(例如`--prefix`)是不受支持的,并且将在未来的pip 20.2版本中被移除。这可能是因为这些选项可能导致意外的行为。建议使用pip级别的选项,如`--user`来安装用户级别的包,`--prefix`来指定安装目录,`--root`用于系统级别的安装,或者`--target`来指定目标安装位置。 3. **ERROR: Command errored out with exit status 1**: 这表明在尝试执行命令时发生了错误,导致进程退出,退出状态为1通常表示执行失败。在这种情况下,可能是由于不正确的命令行参数或者依赖库版本不兼容导致的。 4. **尝试安装的软件包**: 在这个例子中,用户尝试安装的软件包包括`setuptools<49.2.0`、`wheel<=0.35.1`和`Cython>=0`。`setuptools`和`wheel`是Python包管理和构建工具,而`Cython`是一个用于编写Python扩展模块的编译器。可能存在的问题是版本不匹配,或者是源代码安装过程中出现了问题。 解决这类问题的一般步骤包括: - **检查Python环境**:确认使用的Python版本是否与pip3和要安装的软件包兼容。 - **更新pip**:确保pip3是最新的,可以运行`pip3 install --upgrade pip`进行更新。 - **使用虚拟环境**:创建并激活虚拟环境,避免全局环境的冲突,使用`python3 -m venv myenv`创建,然后`source myenv/bin/activate`激活。 - **修改命令**:根据DEPRECATION警告,调整命令行选项,避免使用不受支持的`--install-option`。 - **清除缓存**:有时,清理pip的缓存也可能解决问题,可以使用`pip3 cache purge`。 - **检查网络**:确保可以访问到所需的包仓库,如`https://pypi.tuna.tsinghua.edu.cn`或`https://mirrors.aliyun.com`。 - **日志分析**:查看更详细的错误日志,通常在终端输出的最后几行,可以帮助定位问题所在。 如果以上步骤都无法解决问题,可能需要进一步研究错误消息,或者在相关的开发者论坛上寻求帮助。
cmdoptions.check_install_build_global(options)
DEPRECATION: Location-changing options found in --install-option: ['--prefix'] from command line. This configuration may cause unexpected behavior and is unsupported. pip 20.2 will remove support for this functionality. A possible replacement is using pip-level options like --user, --prefix, --root, and --target. You can find discussion regarding this at https://github.com/pypa/pip/issues/7309.
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python@3.9/bin/python3.9 /Library/Python/3.7/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/t5/cnc2dx3x3nv_9st0xdsv87yh0000gp/T/pip-build-env-rzzpok5l/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host mirrors.aliyun.com -- 'setuptools<49.2.0' 'wheel<=0.35.1' 'Cython>=0.29.21,<3.0'
cwd: None
Complete output (488 lines):
/Library/Python/3.7/site-packages/pip/_internal/commands/install.py:243: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
cmdoptions.check_install_build_global(options)
DEPRECATION: Location-changing options found in --install-option: ['--prefix'] from command line. This configuration may cause unexpected behavior and is unsupported. pip 20.2 will remove support for this functionality. A possible replacement is using pip-level options like --user, --prefix, --root, and --target. You can find discussion regarding this at https://github.com/pypa/pip/issues/7309.
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting setuptools<49.2.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d0/4a/22ee76842d8ffc123d4fc48d24a623c1d206b99968fe3960039f1efc2cbc/setuptools-49.1.3.zip (2.2 MB)
Collecting wheel<=0.35.1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/83/72/611c121b6bd15479cb62f1a425b2e3372e121b324228df28e64cc28b01c2/wheel-0.35.1.tar.gz (59 kB)
Collecting Cython<3.0,>=0.29.21
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d3/38/adc49a5aca4f644e6322237089fdcf194084f5fe41445e6e632f28b32bf7/Cython-0.29.22.tar.gz (2.1 MB)
Skipping wheel build for setuptools, due to binaries being disabled for it.
Skipping wheel build for wheel, due to binaries being disabled for it.
Skipping wheel build for Cython, due to binaries being disabled for it.
Installing collected packages: setuptools, wheel, Cython
Running setup.py install for setuptools: started
Running setup.py install for setuptools: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python@3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t5/cnc2dx3x3nv_9st0xdsv87yh0000gp/T/pip-install-zkkrsj03/setuptools/setup.py'"'"'; __file__='"'"'/private/var/folders/t5/cnc2dx3x3nv_9st0xdsv87yh0000gp/T/pip-install-zkkrsj03/setuptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t5/cnc2dx3x3nv_9st0xdsv87yh0000gp/T/pip-record-zixudz4v/install-record.txt --single-version-externally-managed --prefix /private/var/folders/t5/cnc2dx3x3nv_9st0xdsv87yh0000gp/T/pip-build-env-rzzpok5l/overlay --compile --install-headers /private/var/folders/t5/cnc2dx3x3nv_9st0xdsv87yh0000gp/T/pip-build-env-rzzpok5l/overlay/include/python3.9/setuptools --prefix=/usr/local
cwd: /private/var/folders/t5/cnc2dx3x3nv_9st0xdsv87yh0000gp/T/pip-install-zkkrsj03/setuptools/
Complete output (466 lines):
running install
running build
running build_py
creating build/lib
copying easy_install.py -> build/lib
creating build/lib/setuptools
copying setuptools/ssl_support.py -> build/lib/setuptools
copying setuptools/windows_support.py -> build/lib/setuptools
copying setuptools/_deprecation_warning.py -> build/lib/setuptools
copying setuptools/package_index.py -> build/lib/setuptools
copying setuptools/archive_util.py -> build/lib/setuptools
copying setuptools/_imp.py -> build/lib/setuptools
copying setuptools/config.py -> build/lib/setuptools
copying setuptools/version.py -> build/lib/setuptools
copying setuptools/py31compat.py -> build/lib/setuptools
copying setuptools/depends.py -> build/lib/setuptools
copying setuptools/py27compat.py -> build/lib/setuptools
copying setuptools/__init__.py -> build/lib/setuptools
copying setuptools/installer.py -> build/lib/setuptools
copying setuptools/glob.py -> build/lib/setuptools
copying setuptools/sandbox.py -> build/lib/setuptools
copying setuptools/py34compat.py -> build/lib/setuptools
copying setuptools/launch.py -> build/lib/setuptools
copying setuptools/extension.py -> build/lib/setuptools
copying setuptools/distutils_patch.py -> build/lib/setuptools
copying setuptools/unicode_utils.py -> build/lib/setuptools
copying setuptools/monkey.py -> build/lib/setuptools
copying setuptools/build_meta.py -> build/lib/setuptools
copying setuptools/errors.py -> build/lib/setuptools
copying setuptools/dep_util.py -> build/lib/setuptools
copying setuptools/msvc.py -> build/lib/setuptools
copying setuptools/dist.py -> build/lib/setuptools
剩余16页未读,继续阅读
- 粉丝: 17
- 资源: 1
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 最优条件下三次B样条小波边缘检测算子研究
- 深入解析:wav文件格式结构
- JIRA系统配置指南:代理与SSL设置
- 入门必备:电阻电容识别全解析
- U盘制作启动盘:详细教程解决无光驱装系统难题
- Eclipse快捷键大全:提升开发效率的必备秘籍
- C++ Primer Plus中文版:深入学习C++编程必备
- Eclipse常用快捷键汇总与操作指南
- JavaScript作用域解析与面向对象基础
- 软通动力Java笔试题解析
- 自定义标签配置与使用指南
- Android Intent深度解析:组件通信与广播机制
- 增强MyEclipse代码提示功能设置教程
- x86下VMware环境中Openwrt编译与LuCI集成指南
- S3C2440A嵌入式终端电源管理系统设计探讨
- Intel DTCP-IP技术在数字家庭中的内容保护