阅读pip
文档,我不清楚为额外的包指定--find-links
网址或--index-url/--extra-index-url
之间的区别。
-i, --index-url <url>
Python Package Index的基本URL(默认为https://pypi.python.org/simple)。这应该指向一个存储库 符合PEP 503(简单存储库API)或本地 目录以相同的格式布局。
-f, --find-links <url>
如果是html文件的URL或路径,则解析链接到档案。如果本地路径或文件:// url是一个目录,那么看 对于目录列表中的档案。
据我了解,除了索引网址必须遵循PEP 503之外,两者之间没有真正的区别。我想是遵循在所有可用版本中选择最新版本的通常逻辑。
我错过了两者之间是否存在其他概念上的差异?如果是这样,哪些?如果没有,为什么同时拥有?
答案 0 :(得分:7)
index-url
可以被视为一个页面上只包含其他内容的页面。你告诉pip找到你要在该页面上安装的内容;根据PEP 503,该页面采用可预测的格式。索引将仅列出它可用的包。
find-links
是一个查找某些包的位置数组。您可以将文件路径,单个URL传递给TAR或WHEEL文件,HTML文件,git存储库等。
例如,如果您想使用本地系统中的某些软件包以及在线存储库中的其他软件包,您可以将两者结合使用。
您可以看到pip将在pip/test_index.pyp
单元测试中解析“包裹链接”的所有不同方式。
答案 1 :(得分:-1)
如果您只想在本地安装软件包,请使用"use strict";
import PropTypes from "prop-types";
class ApiErrorApp extends React.Component {
constructor(props) {
super(props);
/*
* State holds reasons and errors for the selected reason
*/
this.state = {
reasons: [],
errors: []
};
}
/*
* if the store changes, we watch for events to be emmitted
* then set the state for the application
*/
_onChange() {
const { reason }= this.context.router.getCurrentParams();
this.setState({
reasons: ApiErrorStore.allReasons(), errors: ApiErrorStore.errorsForReason(reason) }, function(){
if (this.state.errors.length == 0) {
if (this.state.reasons.length == 0) {
router.transitionTo('api-error-root')
} else {
router.transitionTo('error-reason', {reason: reason || this.state.reasons[0].reason});
}
} else {
// transition to first error
router.transitionTo('error', {reason: reason, id: this.state.errors[0].id});
}
});
}
/*
* when mounted, watch for store changes
*/
componentDidMount() {
ApiErrorStore.addChangeListener(this._onChange.bind(this));
}
/*
* stop watching for store changes when unmounted
*/
componentWillUnmount() {
ApiErrorStore.removeChangeListener(this._onChange.bind(this));
}
/*
* generic render function
*
* @returns @jsx
*/
render() {
return (
<div className="api-error-app">
<ErrorList reasons={this.state.reasons}/>
<ReactRouter.RouteHandler errors={this.state.errors} />
</div>
);
}
}
ApiErrorApp.contextTypes = {
router: PropTypes.func,
};
和--find-links someDir