gue*_*tli 15 python pip setup.py
我的python包footools需要html5lib install_requires来自setup.py.
安装setup.py develop失败:
cd src/footools/
python setup.py develop
Processing dependencies for footools==2016.205
Searching for html5lib==0.9999999
Reading https://source.example.com/pypi/simple/html5lib/
Download error on https://source.example.com/pypi/simple/html5lib/:
[Errno 185090050] _ssl.c:354: error:0B084002:x509
certificate routines:X509_load_cert_crl_file:system lib --
Some packages may not be found!
Couldn't find index page for 'html5lib' (maybe misspelled?)
Run Code Online (Sandbox Code Playgroud)
但是直接下载有效:
bar@workdevel123:~/src/footools> pip install html5lib==0.9999999
/home/bar/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79:
InsecurePlatformWarning: A true SSLContext object is not available.
This prevents urllib3 from configuring SSL appropriately
and may cause certain SSL connections to fail.
For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting html5lib==0.9999999
/home/bar/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79:
InsecurePlatformWarning: A true SSLContext object is not available.
This prevents urllib3 from configuring SSL appropriately and
may cause certain SSL connections to fail.
For more information,
see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading https://source.example.com/pypi/packages/html5lib-0.9999999.tar.gz
Requirement already satisfied (use --upgrade to upgrade):
six in /usr/lib/python2.7/site-packages (from html5lib==0.9999999)
Installing collected packages: html5lib
Running setup.py install for html5lib
Successfully installed html5lib-0.9999999
Run Code Online (Sandbox Code Playgroud)
这两种方法有什么区别?
他们为什么不同?
在python中安装依赖项的正确方法是什么?
在setup.py没有特殊:
import setuptools
setuptools.setup(
name='foo',
version='2016.210',
long_description=open('README.txt').read(),
packages=setuptools.find_packages(),
install_requires=[
# about twenty packages before this line
'html5lib==0.9999999'
],
include_package_data=True,
entry_points={
'console_scripts': [
'foo=foo.utils.bar:main',
],
},
)
Run Code Online (Sandbox Code Playgroud)
Niz*_*med 10
python setup.py develop或者setuptools通常用于easy_install满足依赖性,urllib2而依赖性又用于pip使用requests.请看这里easy_install vs pip.
pip更现代,除了其他功能之外,还有能力卸载软件包并符合PEP 438 - 在PyPI上过渡到发布文件托管.您可以实现python setup.py develop与之相同的功能pip install -e src/footools/,请注意项目路径是否在当前目录中使用,./footools.
该requests软件包捆绑了软件包本身的证书python -c 'import pip;print(pip.download.requests.certs.where())'.
setuptools使用系统安装的ca证书python -c 'from setuptools import ssl_support;print(ssl_support.cert_paths)'.
您必须使用update-ca-certificatesUbuntu 等工具更新系统安装的ca证书,以自动更新ca证书或从https://curl.haxx.se/docs/caextract.html下载并安装到其中一个路径setuptools或设置setuptools.ssl_support.cert_paths为empy序列喜欢[]和做pip install certifi.呼叫setuptools.ssl_support.find_ca_bundle()将揭示ca证书的位置.
setuptools是 Python distutils(适用于 Python 2.6 及更高版本)增强功能的集合,使开发人员能够更轻松地构建和分发 Python 包,尤其是依赖于其他包的包。
因此,除其他外,您可以创建可以上传到 Pypi 的包,然后使用安装pip(因此分发您的模块)。
也就是说,它们实际上在安装部分不应该有那么大的不同。您正在运行该develop模式,因此也许您必须稍微修改一下目录或修复授权错误。
在开发模式下,项目被部署到暂存区域(在某种程度上类似于虚拟环境的过程)
部署的完成方式是,对项目源的更改可以立即在暂存区域中可用,而无需在每次更改后运行构建或安装步骤。
这也意味着 Python 解释器可以使用所有内容。稍后可以取消暂存。
我注意到这html5lib是从不同的地方获取的:/pypi/simple/在一种情况下,/pypi/packages/在另一种情况下。
dependency_links满足依赖关系时要搜索的命名 URL 的字符串列表。如果需要安装 setup_requires 或tests_require 指定的包,将使用这些链接。
回到问题,我认为这很可能是ssl问题,因为在 pip 中它处理得很好(即,很好的警告并且有某种解决方法),但 setuptools 不会发生同样的情况。如果请求中存在未处理的错误,则Couldn't find index page for 'html5lib'可能是由于该原因。
| 归档时间: |
|
| 查看次数: |
1791 次 |
| 最近记录: |