简体   繁体   English

Python分发安装Mac

[英]Python distribute installation Mac

I am trying to install distribute module one my mac.我正在尝试在我的 mac 上安装分发模块一。 I tried pip install distribute and got the error我尝试了 pip install distribution 并得到了错误

***"""***

Collecting distribute
  Using cached distribute-0.7.3.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/hj/gz4x7_lj5r9_shsmq40r2y180000gn/T/pip-build-10mpi66y/distribute/setuptools/__init__.py", line 2, in <module>
        from setuptools.extension import Extension, Library
      File "/private/var/folders/hj/gz4x7_lj5r9_shsmq40r2y180000gn/T/pip-build-10mpi66y/distribute/setuptools/extension.py", line 5, in <module>
        from setuptools.dist import _get_unpatched
      File "/private/var/folders/hj/gz4x7_lj5r9_shsmq40r2y180000gn/T/pip-build-10mpi66y/distribute/setuptools/dist.py", line 7, in <module>
        from setuptools.command.install import install
      File "/private/var/folders/hj/gz4x7_lj5r9_shsmq40r2y180000gn/T/pip-build-10mpi66y/distribute/setuptools/command/__init__.py", line 8, in <module>
        from setuptools.command import install_scripts
      File "/private/var/folders/hj/gz4x7_lj5r9_shsmq40r2y180000gn/T/pip-build-10mpi66y/distribute/setuptools/command/install_scripts.py", line 3, in <module>
        from pkg_resources import Distribution, PathMetadata, ensure_directory
      File "/private/var/folders/hj/gz4x7_lj5r9_shsmq40r2y180000gn/T/pip-build-10mpi66y/distribute/pkg_resources.py", line 1518, in <module>
        register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
    AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/hj/gz4x7_lj5r9_shsmq40r2y180000gn/T/pip-build-10mpi66y/distribute/

***"""***

I tried the program "distribute_setup.py" and by running "python3.6 install_distribute.py" but got the error "urllib.error.HTTPError: HTTP Error 403: SSL is required"我尝试了程序“distribute_setup.py”并运行“python3.6 install_distribute.py”但得到了错误“urllib.error.HTTPError:HTTP错误403:需要SSL”

I tried updating urllib but it said it was correct.我尝试更新 urllib 但它说它是正确的。 any recommendations?有什么建议吗?

The 'Distribute' module is deprecated. “分发”模块已弃用。 Its development is now part of 'Setuptools'.它的开发现在是“Setuptools”的一部分。 So, if you install 'Setuptools' you should get 'Distribute'.所以,如果你安装了“Setuptools”,你应该得到“Distribute”。 See:看:

The first link to PyPI even says that 'Distribute': PyPI 的第一个链接甚至说“分发”:

This package is a simple compatibility layer that installs Setuptools 0.7+.这个包是一个简单的兼容层,它安装了 Setuptools 0.7+。

So, you might have better luck by trying to install or update 'Setuptools'.因此,尝试安装或更新“Setuptools”可能会带来更好的运气。 To get more into it, I think there is a problem with either:为了更深入地了解它,我认为两者都存在问题:

  1. Your pip version你的 pip 版本
  2. Your Python version你的 Python 版本
  3. Or, your 'Setuptools'或者,您的“设置工具”

This is the line that I am interested in:这是我感兴趣的行:

AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

This error seems like something is trying to use a newly added feature that doesn't exist in the old version of a file.此错误似乎是在尝试使用旧版本文件中不存在的新添加功能。 So, you probably need to update pip or 'Setuptools'.因此,您可能需要更新 pip 或“Setuptools”。

Try:尝试:

Specifically, see this answer: https://stackoverflow.com/a/47278208/9347694具体看这个答案: https : //stackoverflow.com/a/47278208/9347694

Also try,也试试,

Seems like others experienced this issue after installing Python 3.6.似乎其他人在安装 Python 3.6 后遇到了这个问题。 Are you sure you are using pip3?您确定您使用的是 pip3 吗? Is pip updated? pip 更新了吗? Do you have 'Seyuptools' installed properly?您是否正确安装了“Seyuptools”?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM