当pip安装好pylint时,会安装哪些文件? [英] which files get installed when `pip` installing `pylint`?

查看:171
本文介绍了当pip安装好pylint时,会安装哪些文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行了pip install --user pylint,但没有发现任何错误.但是,pylint foo.py会引发错误pylint: command not found.

GitHub存储库相比,看来我的计算机上只有一个子集(请参见下文) ).无论如何,我没有任何名为pylint文件.

如果无法直接使用,我可以手动安装任何东西吗?

这是我拥有的文件:

/Users/erc/Library/Python/2.7/lib/python/site-packages/pylint下:
__init__.py
__init__.pyc
__main__.py
__main__.pyc
__pkginfo__.py
__pkginfo__.pyc
checkers
config.py
config.pyc
epylint.py
epylint.pyc
exceptions.py
exceptions.pyc
extensions
graph.py
graph.pyc
interfaces.py
interfaces.pyc
lint.py
lint.pyc
pyreverse
reporters
test
testutils.py
testutils.pyc
utils.py
utils.pyc

(我没有列出子目录checkers等中的文件)

,还有另一个文件夹, /Users/erc/Library/Python/2.7/lib/python/site-packages/pylint-1.9.2.dist-info
DESCRIPTION.rst
INSTALLER
METADATA
RECORD
WHEEL
entry_points.txt
metadata.json
top_level.txt

解决方案

如果共享您的pip运行中的错误/输出,可能会更有用,我想在pip日志中还有更多详细信息.通常,这样的提示是可以找到错误的好提示:

Command "python setup.py egg_info" failed with error code 1 in /some/path

我首先要检查是否确实安装了pylint

pip list | grep pylint

如果不是,请按照pip install中的错误进行操作.但是,如果pylint可用但仍运行pylint是问题(找不到命令),那是因为命令行入口点未正确安装.然后可以这样运行:

python -m pylint --help

附带说明,通常使用虚拟环境是安装软件包/软件的好方法在用户可访问路径上,以及将可执行程序(而不是库软件包)安装到本地用户可访问路径上,我建议使用类似the GitHub repository it looks like I only have a subset on my computer (see below). At any rate, I don't have any file named pylint.

Is there anything I can install by hand if it didn't work straight out-of-the-box?

Here are the files that I have:

under /Users/erc/Library/Python/2.7/lib/python/site-packages/pylint:
__init__.py
__init__.pyc
__main__.py
__main__.pyc
__pkginfo__.py
__pkginfo__.pyc
checkers
config.py
config.pyc
epylint.py
epylint.pyc
exceptions.py
exceptions.pyc
extensions
graph.py
graph.pyc
interfaces.py
interfaces.pyc
lint.py
lint.pyc
pyreverse
reporters
test
testutils.py
testutils.pyc
utils.py
utils.pyc

(I am not listing the files within the subdirectories checkers, etc.)

and there is also another folder, /Users/erc/Library/Python/2.7/lib/python/site-packages/pylint-1.9.2.dist-info with
DESCRIPTION.rst
INSTALLER
METADATA
RECORD
WHEEL
entry_points.txt
metadata.json
top_level.txt

解决方案

It could be more helpful if errors/output from your pip run was shared, I guess there are more details in pip logs. Usually something like this is a good hint where you can find the errors:

Command "python setup.py egg_info" failed with error code 1 in /some/path

I'd first check if pylint is actually installed

pip list | grep pylint

If not, then follow the errors from pip install. But if pylint is available yet running pylint is the problem (command not found), it's because the command line entry point is not installed properly. Then it may be run like this:

python -m pylint --help

On a side note, generally using virtual environments are a nice way to install packages/software on user accessible paths, and to install executable programs (as opposed to library packages) to local user accessible paths, I suggest using something like pipsi instead of pip, which handles creating/activating the virtualenv automatically.

Update

As discussed on the comments, since your current installation is OK and it's just the command line entry point missing, you could add a Python file (with exec permissions) somewhere in your path for each of the entry points, like this:

#!/usr/bin/env python
from pylint import run_pylint
if __name__ == '__main__':
    run_pylint()

这篇关于当pip安装好pylint时,会安装哪些文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆