今天在windows电脑上安装django-export-xls的时候报错了:
(venv) PS F:Pycharm_ProjectsRuoyi-Energy> pip3 install django-export-xls
Collecting django-export-xls
Using cached django-export-xls-0.1.1.tar.gz (3.2 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
obabyAppDataLocalTemppip-pip-egg-info-u0lvqod1'
cwd: C:UsersobabyAppDataLocalTemppip-install-xrhra6sxdjango-export-xls_d72b66d322264c26b516fda785f307fd
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:UsersobabyAppDataLocalTemppip-install-xrhra6sxdjango-export-xls_d72b66d322264c26b516fda785f307fdsetup.py", line 4, in <module>
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 918: illegal multibyte sequence
----------------------------------------
pip安装报错了,于是尝试通过python直接setup.py安装,
python .third_libsdjango-export-xlssetup.py install
同样报错了:
(venv) PS F:Pycharm_ProjectsRuoyi-Energy> python .third_libsdjango-export-xlssetup.py install
Traceback (most recent call last):
File ".third_libsdjango-export-xlssetup.py", line 6, in <module>
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 918: illegal multibyte sequence
可以看到,是编码问题。修改setup.py第四行为:
README = open(os.path.join(os.path.dirname(__file__), 'README.rst'),encoding='utf8').read()
增加编码为utf8,再次安装就ok了:
(venv) PS F:Pycharm_ProjectsRuoyi-Energy> python .third_libsdjango-export-xlssetup.py install
running install
F:Pycharm_ProjectsRuoyi-Energyvenvlibsite-packagessetuptoolscommandinstall.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
F:Pycharm_ProjectsRuoyi-Energyvenvlibsite-packagessetuptoolscommandeasy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running bdist_egg
running egg_info
creating django_export_xls.egg-info
writing manifest file 'django_export_xls.egg-infoSOURCES.txt'
writing manifest file 'django_export_xls.egg-infoSOURCES.txt'
running install_lib
running build_py
creating build
creating buildlib
creating buildlibexport_xls
copying export_xlsmodels.py -> buildlibexport_xls
copying export_xlstests.py -> buildlibexport_xls
copying export_xlsurls.py -> buildlibexport_xls
copying export_xlsviews.py -> buildlibexport_xls
copying export_xls__init__.py -> buildlibexport_xls
creating buildbdist.win-amd64
creating buildbdist.win-amd64egg
creating buildbdist.win-amd64eggexport_xls
byte-compiling buildbdist.win-amd64eggexport_xlsmodels.py to models.cpython-38.pyc
byte-compiling buildbdist.win-amd64eggexport_xlstests.py to tests.cpython-38.pyc
byte-compiling buildbdist.win-amd64eggexport_xlsurls.py to urls.cpython-38.pyc
byte-compiling buildbdist.win-amd64eggexport_xlsviews.py to views.cpython-38.pyc
byte-compiling buildbdist.win-amd64eggexport_xls__init__.py to __init__.cpython-38.pyc
creating buildbdist.win-amd64eggEGG-INFO
copying django_export_xls.egg-infoPKG-INFO -> buildbdist.win-amd64eggEGG-INFO
copying django_export_xls.egg-infoSOURCES.txt -> buildbdist.win-amd64eggEGG-INFO
copying django_export_xls.egg-inforequires.txt -> buildbdist.win-amd64eggEGG-INFO
copying django_export_xls.egg-infotop_level.txt -> buildbdist.win-amd64eggEGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
removing 'buildbdist.win-amd64egg' (and everything under it)
Copying django_export_xls-0.1.1-py3.8.egg to f:pycharm_projectsruoyi-energyvenvlibsite-packages
F:Pycharm_ProjectsRuoyi-Energyvenvlibsite-packagespkg_resources__init__.py:116: PkgResourcesDeprecationWarning: is an invalid version and will not be supported in a future release
warnings.warn(
Installing xlwt-1.3.0-py2.py3-none-any.whl to f:pycharm_projectsruoyi-energyvenvlibsite-packages
(venv) PS F:Pycharm_ProjectsRuoyi-Energy> git add .
warning: in the working copy of 'third_libs/django-export-xls/.gitignore', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/LICENSE', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/README.rst', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/README.md', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/app/admin.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/app/models.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/app/templates/index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/app/tests.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/app/urls.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/app/views.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/django_export_xls/urls.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/django_export_xls/wsgi.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/example/manage.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/export_xls/models.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/export_xls/tests.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/export_xls/urls.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/export_xls/views.py', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/requirements.txt', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'third_libs/django-export-xls/setup.py', LF will be replaced by CRLF the next time Git touches it
目前线上的代码已经更新,通过setup.py在windows下安装即可。
Django export XLS https://github.com/obaby/django-export-xls 1 forks. 0 stars. 0 open issues.
Recent commits:
- Update setup.py修复windows下安装编码错误, GitHub
- udpate, obaby
- update, obaby
- Merge pull request #3 from DarkerCz/masterchanged mimetype to content_type, Mauricio
- changed mimetype to content_type, DarkerCz