我的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"],
)
然后我分开了:
source activate py3
python setup.py bdist_eg
我在python 3.6
,setuptools==36.2.7
中运行它,得到这样的egg文件:dist/demo-0.0.1-py3.6.egg
。我在python3中没有任何错误地安装了这个egg文件。
但是如果我想在python 2.7
中安装这个鸡蛋文件,我运行它:
source activate py2
easy_install dist/demo-0.0.1-py3.6.egg
我得到这样的错误:
error: Could not find suitable distribution for Requirement.parse('demo==0.0.1')
答案 0 :(得分:1)
现在最好的做法是使用wheel格式(而不是鸡蛋)并使用pip进行安装。
在你的virtualenv:
#include <iostream>
#include "rapidxml/rapidxml.hpp"
#include "rapidxml/rapidxml_utils.hpp"
int main(int argc, char *argv[]){
rapidxml::xml_document<> doc;
rapidxml::file<> xmlFile("myFile.odx-f");
doc.parse<0>(xmlFile.data());
rapidxml::xml_node<>* flashContainer = doc.first_node("ODX")->first_node("FLASH");
if(flashContainer){
std::cout << flashContainer->first_node("SHORT-NAME")->value() << std::endl; /* prints the shortname of the flash container */
for (rapidxml::xml_node<>* ecuMem = flashContainer->first_node("ECU-MEMS")->first_node("ECU-MEM"); ecuMem; ecuMem = ecuMem->next_sibling("ECU-MEM")) {
/* iterates over all ecu memory descriptors */
std::cout << ecuMem->first_node("SHORT-NAME")->value() << std::endl; /* prints the shortname of the ecu memory descriptor */
}
for (rapidxml::xml_node<>* ecuMemCon = flashContainer->first_node("ECU-MEM-CONNECTORS")->first_node("ECU-MEM-CONNECTOR"); ecuMemCon; ecuMemCon = ecuMemCon->next_sibling("ECU-MEM-CONNECTOR")) {
/* iterates over all ecu memory connectors */
std::cout << ecuMemCon->first_node("SHORT-NAME")->value() << std::endl; /* prints the shortname of the ecu memory connector */
}
}
return 0;
}
在pip install wheel
python setup.py bdist_wheel
目录中,您将获得.whl文件。
然后在py2 virtualenv中你可以这样做:
dist