简体   繁体   English

从PIP安装的软件包访问文件

[英]Accessing Files from PIP installed packages

I have installed a python package using pip install . 我已经使用pip install安装了python软件包。 I have identified the package folders within /usr/local/lib/python2.7/dist-packages . 我已经确定了/usr/local/lib/python2.7/dist-packages的软件包文件夹。 What I want to do now is to access the tutorial files and/or examples of that specific package. 我现在要做的是访问教程文件和/或该特定软件包的示例。 I know that based on the github page related to this package that it has examples and I can see the examples folder on the webpage. 我知道,基于与此包相关的github页面,它包含示例,并且我可以在网页上看到examples文件夹。

I want to ask whether all folders of a github page are cloned in some directory after pip install or these two ( git and pip) are two completely different ways of installing. 我想问一下是否在pip install之后将github页面的所有文件夹都克隆到某个目录中,或者这两个(git和pip)是两种完全不同的安装方式。 If the last question is true, how do I install and setup a package using the git command. 如果最后一个问题是正确的,我该如何使用git命令安装和设置软件包。

Some packages include their examples and tests in the install, some do not. 有些软件包在安装中包括其示例和测试,而有些则没有。 The location is also not entirely standardized (they may be inside the package directory or eg /usr/share/... ). 该位置也不是完全标准化的(它们可能位于包目录中,例如/usr/share/... )。 So whether and where you can find the examples depends on the package. 因此,是否以及在何处可以找到示例取决于软件包。

If you want to install the git version of a package, you typically clone it: 如果要安装软件包的git版本,通常可以克隆它:

git clone https://github.com/someuser/somepackage.git dirname

Then use the included setup.py to install: 然后使用随附的setup.py进行安装:

python setup.py install

(You may need to do that as a superuser. You may also need to uninstall the pip package to use it, if it goes to a different place than pip-installed packages.) (您可能需要以超级用户身份进行操作。如果将pip软件包放到与pip安装的软件包不同的位置,则可能还需要卸载pip软件包才能使用它。)

The examples may still not be installed anywhere, but they'll be there for you to see in the git repository – whether or not you install the package. 这些示例可能仍未安装在任何地方,但是无论您是否安装软件包,都可以在git存储库中看到它们。

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

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