【问题标题】:trying to install pip for python3.6 - setuptools not found尝试为 python3.6 安装 pip - 找不到 setuptools
【发布时间】:2018-05-09 21:48:55
【问题描述】:

为什么 python 认为我缺少 setuptools?就在这里:

[me@my_server site-packages]$ pwd
/usr/lib/python3.6/site-packages
[me@my_server site-packages]$ ll
total 8.0K
drwxr-xr-x. 5 root   83 May  9 21:11 .
drwxr-xr-x. 3 root   26 May  9 21:01 ..
-rw-r--r--. 1 root  126 May  9 21:06 easy_install.py
drwxr-xr-x. 4 root   56 May  9 21:11 pkg_resources
drwxr-xr-x. 2 root    6 Jan  4 16:42 __pycache__
drwxr-xr-x. 4 root 4.0K May  9 21:10 setuptools
[me@my_server site-packages]$ pwd
/usr/lib/python3.6/site-packages
[me@my_server site-packages]$ python3 easy_install.py pip
Traceback (most recent call last):
  File "easy_install.py", line 4, in <module>
    from setuptools.command.easy_install import main
  File "/usr/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 47, in <module>
    from setuptools.package_index import PackageIndex
  File "/usr/lib/python3.6/site-packages/setuptools/package_index.py", line 203, in <module>
    sys.version[:3], require('setuptools')[0].version
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 962, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 849, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'setuptools' distribution was not found and is required by the application



$ ll setuptools/
total 192K
drwxr-xr-x. 4 root 4.0K May  9 21:10 .
drwxr-xr-x. 5 root   83 May  9 21:11 ..
-rw-r--r--. 1 root 6.5K May  9 21:11 archive_util.py
drwxr-xr-x. 3 root 4.0K May  9 21:10 command
-rw-r--r--. 1 root 2.2K May  9 21:11 compat.py
-rw-r--r--. 1 root 6.3K May  9 21:11 depends.py
-rw-r--r--. 1 root  35K May  9 21:11 dist.py
-rw-r--r--. 1 root 1.7K May  9 21:11 extension.py
-rw-r--r--. 1 root 5.3K May  9 21:11 __init__.py
-rw-r--r--. 1 root 2.0K May  9 21:11 lib2to3_ex.py
-rw-r--r--. 1 root 2.2K May  9 21:11 msvc9_support.py
-rw-r--r--. 1 root  39K May  9 21:11 package_index.py
-rw-r--r--. 1 root  431 May  9 21:11 py26compat.py
-rw-r--r--. 1 root  306 May  9 21:11 py27compat.py
-rw-r--r--. 1 root 1.6K May  9 21:11 py31compat.py
drwxr-xr-x. 2 root 4.0K May  9 21:10 __pycache__
-rw-r--r--. 1 root  14K May  9 21:11 sandbox.py
-rw-r--r--. 1 root  201 May  9 21:11 script (dev).tmpl
-rw-r--r--. 1 root  138 May  9 21:11 script.tmpl
-rw-r--r--. 1 root 2.4K May  9 21:11 site-patch.py
-rw-r--r--. 1 root 8.0K May  9 21:11 ssl_support.py
-rw-r--r--. 1 root  981 May  9 21:11 unicode_utils.py
-rw-r--r--. 1 root  293 May  9 21:11 utils.py
-rw-r--r--. 1 root   21 May  9 21:11 version.py
-rw-r--r--. 1 root  714 May  9 21:11 windows_support.py

【问题讨论】:

    标签: python-3.x pip centos7


    【解决方案1】:

    您是否正在运行 Python 2.7?您可能为 Python 2.7 安装了 setuptools,因此您认为它运行良好。

    为了使用 Python 3.6 的 setuptools,您需要为 Python 3.6 而不是旧版本安装它。

    无论哪种方式,您都可以尝试按原样安装 egg 文件,然后您将可以访问 Python 3.6 的 setuptools。

    【讨论】:

    • /usr/lib/python3.6/site-packages 下,我看到了 setuptools。如何“按原样安装 egg”?
    • 您需要下载 egg 文件并提取内容。如果您在上述目录中看到 setuptools,那么它应该可以工作。我会推荐其他用户所说的“apt-get pip”,然后您就可以根据需要进行“pip install”。
    【解决方案2】:

    您可以使用以下命令安装 pip:apt-get install pip

    【讨论】:

    • centos 上没有 apt
    • 和 yum 存在吗?
    • 因为您可以使用命令行安装 pip:yum -y install python-pip
    猜你喜欢
    • 2013-01-22
    • 2017-05-26
    • 2018-09-30
    • 2010-12-31
    • 2021-04-04
    • 1970-01-01
    • 2018-01-31
    • 2018-02-21
    • 2017-08-02
    相关资源
    最近更新 更多