我在 Ubuntu 上下载并安装了 pip。然后我尝试安装 PLY 和 My xml 等软件包。但我得到了一串用红色写的句子。我曾经pip install ply.3.4.jar
安装过。我该怎么做才能安装软件包?
答案1
首先在 PyPI 上搜索包
pip search <seach_string>
例子:
pip search ply | grep -i '^ply'
输出:
plyer - Platform-independant wrapper for platform-dependant APIs
plyvel - Plyvel, a fast and feature-rich Python interface to LevelDB
plywood - A template language grammar inspired by the Python code aesthetic
ply - Python Lex & Yacc
plytix-retailers-sdk - Plytix Retailers SDK for Python
plymgf - A MGF files reader with PLY
plyfile - PLY file reader/writer
plypatch - Ply: Git-based Patch Management
plyj - A Java parser written in Python using PLY.
plyr - UNKNOWN
PlyPlus - a friendly yet powerful LR-parser written in Python
然后安装你想要的包:
pip install <package_name>
例子:
pip install ply
答案2
您应该使用:
pip install ply
pip 实际上会下载并安装包及其依赖项,因此您不需要单独下载文件。
另一个选择是下载层(或任何其他软件包),然后自行安装。在我的系统中,它安装在:
/usr/local/lib/python2.7/dist-packages/ply