python3 bdist_egg无法安装在python2中?
我的python3 bdist_egg无法安装在python2中?,python,setuptools,egg,Python,Setuptools,Egg,我的setup.py如下所示: #!/usr/bin/env python # encoding: utf-8 from setuptools import setup setup(name='demo', version='0.0.1', packages=["demo"], package_dir={'demo':'demo'}, install_requires=["requests"], ) error: Could not find
setup.py
如下所示:
#!/usr/bin/env python
# encoding: utf-8
from setuptools import setup
setup(name='demo',
version='0.0.1',
packages=["demo"],
package_dir={'demo':'demo'},
install_requires=["requests"],
)
error: Could not find suitable distribution for Requirement.parse('demo==0.0.1')
然后我把它分开:
source activate py3
python setup.py bdist_eg
我在python3.6
中运行它,setuptools==36.2.7
,得到如下egg文件:dist/demo-0.0.1-py3.6.egg
。我在python3中安装了这个egg文件,没有任何错误
但是如果我想在python 2.7中安装这个egg文件,我会运行以下命令:
source activate py2
easy_install dist/demo-0.0.1-py3.6.egg
我得到了这样的错误:
#!/usr/bin/env python
# encoding: utf-8
from setuptools import setup
setup(name='demo',
version='0.0.1',
packages=["demo"],
package_dir={'demo':'demo'},
install_requires=["requests"],
)
error: Could not find suitable distribution for Requirement.parse('demo==0.0.1')
现在的最佳实践是使用格式(而不是egg)并使用pip安装 在您的虚拟视频中:
pip install wheel
python setup.py bdist_wheel
在dist
目录中,您将看到一个.whl文件
然后在py2 virtualenv中,您可以执行以下操作:
pip install your-lib-xyz.whl
您在python2.7中使用哪个版本的seruptools?@LaurentPorte
setuptools==36.2.7
。我建议您使用pip而不是简易安装。更现代,可以处理“轮子”格式。@LaurentPorte但如何使用pip
安装本地egg文件?另外,easy\u install
由setuptools
本身提供,它应该可以工作。如果您有最新版本的pip,您可以安装“egg”文件。或者,升级它:pip安装——升级pip
。