python3.7安装robotframework-excellibrary失败
问题:使用pip3命令安装robotframework-excellibrary失败
报错:execfile(join(dirname(file), ‘ExcelLibrary’, ‘version.py’)) NameError: name ‘execfile’ is not defined
原因:robotframework-excellibrary适用于python2.x版本,不兼容python3.x版本
解决
1、离线下载robotframework-excellibrary
下载地址:https://files.pythonhosted.org/packages/b8/e7/8c079a814e7ad288ec2fc15671d8dc526e3d537bb00e4ab2b209a63674ed/robotframework-excellibrary-0.0.2.zip
2、下载的文件解压到pthon的site-packages文件夹中
我的地址为:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages

3、robotframework-excellibrary内修改setup.py文件,打开文件“/robotframework-excellibrary-0.0.2/setup.py”
#execfile(join(dirname(__file__), 'ExcelLibrary', 'version.py'))
exec(open(join(dirname(__file__), 'ExcelLibrary', 'version.py')).read())

4、修改/robotframework-excellibrary-0.0.2/ExcelLibrary/ExcelLibrary.py
#from version import VERSION
from .version import VERSION

5、/robotframework-excellibrary-0.0.2/ExcelLibrary/ExcelLibrary.py
将所有的print xxx 语句修改为 print(xxx)

6、修改/robotframework-excellibrary-0.0.2/ExcelLibrary/__init__.py
#from ExcelLibrary import ExcelLibrary
#from version import VERSION
from .ExcelLibrary import ExcelLibrary
from .version import VERSION

7、终端进入文件夹后执行命令离线安装
python3 setup.py install

8、pip3 list查看是否安装成功

9、重启ride,重新导入ExcelLibrary
10、提示缺少模块,正常安装即可
pip3 install natsort

pip3 install xlwt

pip3 install xlutils

11、再次重启ride,导入ExcelLibrary成功

 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号