简体   繁体   English

Python 包没有 setup.py,

[英]Python package does not have setup.py,

I would like to install this library with pip: ikpy library .我想用 pip: ikpy library安装这个 However pip gives the error below:但是 pip 给出了以下错误:

Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: '/tmp/pip-build-oYTjdr/ikpy/setup.py'

What I understand from the error, pip cannot find setup.py, becuase library has setup.cfg instead.我从错误中了解到,pip 找不到 setup.py,因为库中有 setup.cfg。 I tried to upgrade pip and got a different error.我尝试升级 pip 并遇到不同的错误。

$ pip install --upgrade pip
Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-KCnfi9/pip/setup.py", line 7
        def read(rel_path: str) -> str:
                         ^
    SyntaxError: invalid syntax

I also tried pip3:我也试过 pip3:

$ pip3 install ikpy
ModuleNotFoundError: No module named 'pip._vendor.pkg_resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 13, in <module>
    from pip.exceptions import InstallationError, CommandError, PipError
  File "/usr/lib/python3/dist-packages/pip/exceptions.py", line 6, in <module>
    from pip._vendor.six import iteritems
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 75, in <module>
    vendored("pkg_resources")
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2927, in <module>
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2913, in _call_aside
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 956, in subscribe
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2952, in <lambda>
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2515, in activate
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2097, in declare_namespace
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2047, in _handle_ns
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'

What should I do?我该怎么办?

Python 3.7.10, python3-pip: (8.1.1-2ubuntu0.6). Python 3.7.10,python3-pip: (8.1.1-2ubuntu0.6)。

Note:笔记:

I solved with these commands, now it can be installed with pip3:我用这些命令解决了,现在可以用pip3安装了:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py 
pip3 install --upgrade setuptools

您使用的pip命令很可能适用于 Python 2。您可以尝试使用pip3吗?

From ikpy library:来自ikpy库:

Starting with IKPy v3.1, only Python 3 is supported. 
For versions before v3.1, the library can work with both versions of Python (2.7 and 3.x).

You can download the latest version compatible with python 2 here: https://github.com/Phylliade/ikpy/releases/tag/v3.0.1你可以在这里下载与python 2兼容的最新版本: https : //github.com/Phylliade/ikpy/releases/tag/v3.0.1

note: using python 2.7 is not recommended because support for Python version 2.7 will end on January 1, 2020注意:不建议使用 python 2.7,因为对 Python 2.7 版的支持将于 2020 年 1 月 1 日结束

Upgrade Your Pip升级你的Pip

 pip install --upgrade pip

then install ikpy Now it's should up and running ;-)然后安装ikpy现在它应该启动并运行 ;-)

pip install ikpy

Installed and Checked now on: Ubuntu 20.04, Pip 21.3, Python 3.8.10现在安装和检查:Ubuntu 20.04、Pip 21.3、Python 3.8.10

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

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