安装xlutils遇到的错误

最近在学习python,然后各种折腾。

系统用的windows8.1,python使用的是3.42版本,文本编辑使用notepad++,IDE使用pycharm 社区版。
python 配备pip和easy_install。
不过在安装xlutils的时候发生了一些不愉快。
主要是xlutils需要一些东西,而这些东西系统不能满足。
主要是xlutils 虽然说是可以在python3.x以上版本可以运行但是,xlwt有些问题,对应的python 3.x版本的xlwt是xlwt3(印象是这个),而实际上xlwt3早就不开发了,还不如xlwt呢,不过我发现了一个xlwt-future,所以动手改了一下xlutils的setup.py文件。
  1. packages=['xlutils','xlutils.tests'],
  2. zip_safe=False,
  3. include_package_data=True,
  4. install_requires=[
  5. 'xlrd >= 0.7.2',
  6. 'xlwt_future >= 0.7.4',
  7. ],
其中有这么一段,把xlwt改为了xlwt_future,所以后面安装就很顺利。
如果不这样,python一直报的错误是
  1. from xlwt import __VERSION__
  2. File "C:\Users\ADMINI~1\AppData\Local\Temp\pip_build_Administrator\xlwt\xlwt\_
  3. _init__.py", line 3, in <module>
  4. from Workbook import Workbook
  5. ImportError: No module named 'Workbook'
另一个问题就是xlutils-1.7.1包中的setup.py中的第十四行,有一处
  1. version=file(os.path.join(base_dir, name, 'version.txt')).read().strip(),
实际上python 3.42中file()的方法已经被去掉了,已经被open()方法取代
  1. version=open(os.path.join(base_dir, name, 'version.txt')).read().strip(),
and it works!
so thats all!
  1. D:\下载夹\xlutils-1.7.1\xlutils-1.7.1>pip install xlutils
  2. Requirement already satisfied (use --upgrade to upgrade): xlutils in c:\python34
  3. \lib\site-packages\xlutils-0.0.0-py3.4.egg
  4. Requirement already satisfied (use --upgrade to upgrade): xlrd>=0.7.2 in c:\pyth
  5. on34\lib\site-packages (from xlutils)
  6. Downloading/unpacking xlwt>=0.7.4 (from xlutils)
  7. Running setup.py (path:C:\Users\ADMINI~1\AppData\Local\Temp\pip_build_Administ
  8. rator\xlwt\setup.py) egg_info for package xlwt
  9. Traceback (most recent call last):
  10. File "<string>", line 17, in <module>
  11. File "C:\Users\ADMINI~1\AppData\Local\Temp\pip_build_Administrator\xlwt\se
  12. tup.py", line 4, in <module>
  13. from xlwt import __VERSION__
  14. File "C:\Users\ADMINI~1\AppData\Local\Temp\pip_build_Administrator\xlwt\xl
  15. wt\__init__.py", line 3, in <module>
  16. from Workbook import Workbook
  17. ImportError: No module named 'Workbook'
  18. Complete output from command python setup.py egg_info:
  19. Traceback (most recent call last):
  20. File "<string>", line 17, in <module>
  21. File "C:\Users\ADMINI~1\AppData\Local\Temp\pip_build_Administrator\xlwt\setup.
  22. py", line 4, in <module>
  23. from xlwt import __VERSION__
  24. File "C:\Users\ADMINI~1\AppData\Local\Temp\pip_build_Administrator\xlwt\xlwt\_
  25. _init__.py", line 3, in <module>
  26. from Workbook import Workbook
  27. ImportError: No module named 'Workbook'
  28. ----------------------------------------
  29. Cleaning up...
  30. Command python setup.py egg_info failed with error code 1 in C:\Users\ADMINI~1\A
  31. ppData\Local\Temp\pip_build_Administrator\xlwt
  32. Storing debug log for failure in C:\Users\Administrator\pip\pip.log
  33. D:\下载夹\xlutils-1.7.1\xlutils-1.7.1>setup.py install
  34. running install
  35. running bdist_egg
  36. running egg_info
  37. writing requirements to xlutils.egg-info\requires.txt
  38. writing dependency_links to xlutils.egg-info\dependency_links.txt
  39. writing xlutils.egg-info\PKG-INFO
  40. writing entry points to xlutils.egg-info\entry_points.txt
  41. writing top-level names to xlutils.egg-info\top_level.txt
  42. reading manifest file 'xlutils.egg-info\SOURCES.txt'
  43. writing manifest file 'xlutils.egg-info\SOURCES.txt'
  44. installing library code to build\bdist.win32\egg
  45. running install_lib
  46. running build_py
  47. creating build\bdist.win32\egg
  48. creating build\bdist.win32\egg\xlutils
  49. copying build\lib\xlutils\copy.py -> build\bdist.win32\egg\xlutils
  50. copying build\lib\xlutils\display.py -> build\bdist.win32\egg\xlutils
  51. copying build\lib\xlutils\filter.py -> build\bdist.win32\egg\xlutils
  52. copying build\lib\xlutils\license.txt -> build\bdist.win32\egg\xlutils
  53. copying build\lib\xlutils\margins.py -> build\bdist.win32\egg\xlutils
  54. copying build\lib\xlutils\save.py -> build\bdist.win32\egg\xlutils
  55. copying build\lib\xlutils\styles.py -> build\bdist.win32\egg\xlutils
  56. creating build\bdist.win32\egg\xlutils\tests
  57. copying build\lib\xlutils\tests\date.xls -> build\bdist.win32\egg\xlutils\tests
  58. copying build\lib\xlutils\tests\datetime.xls -> build\bdist.win32\egg\xlutils\te
  59. sts
  60. copying build\lib\xlutils\tests\fixtures.py -> build\bdist.win32\egg\xlutils\tes
  61. ts
  62. copying build\lib\xlutils\tests\ragged.xls -> build\bdist.win32\egg\xlutils\test
  63. s
  64. copying build\lib\xlutils\tests\sample.xlsx -> build\bdist.win32\egg\xlutils\tes
  65. ts
  66. copying build\lib\xlutils\tests\test.xls -> build\bdist.win32\egg\xlutils\tests
  67. copying build\lib\xlutils\tests\testall.xls -> build\bdist.win32\egg\xlutils\tes
  68. ts
  69. copying build\lib\xlutils\tests\testnoformatting.xls -> build\bdist.win32\egg\xl
  70. utils\tests
  71. copying build\lib\xlutils\tests\test_copy.py -> build\bdist.win32\egg\xlutils\te
  72. sts
  73. copying build\lib\xlutils\tests\test_docs.py -> build\bdist.win32\egg\xlutils\te
  74. sts
  75. copying build\lib\xlutils\tests\test_filter.py -> build\bdist.win32\egg\xlutils\
  76. tests
  77. copying build\lib\xlutils\tests\test_save.py -> build\bdist.win32\egg\xlutils\te
  78. sts
  79. copying build\lib\xlutils\tests\test_styles.py -> build\bdist.win32\egg\xlutils\
  80. tests
  81. copying build\lib\xlutils\tests\test_view.py -> build\bdist.win32\egg\xlutils\te
  82. sts
  83. copying build\lib\xlutils\tests\__init__.py -> build\bdist.win32\egg\xlutils\tes
  84. ts
  85. copying build\lib\xlutils\version.txt -> build\bdist.win32\egg\xlutils
  86. copying build\lib\xlutils\view.py -> build\bdist.win32\egg\xlutils
  87. copying build\lib\xlutils\__init__.py -> build\bdist.win32\egg\xlutils
  88. byte-compiling build\bdist.win32\egg\xlutils\copy.py to copy.cpython-34.pyc
  89. byte-compiling build\bdist.win32\egg\xlutils\display.py to display.cpython-34.py
  90. c
  91. byte-compiling build\bdist.win32\egg\xlutils\filter.py to filter.cpython-34.pyc
  92. File "build\bdist.win32\egg\xlutils\filter.py", line 699
  93. print repr(self.name),
  94. ^
  95. SyntaxError: invalid syntax
  96. byte-compiling build\bdist.win32\egg\xlutils\margins.py to margins.cpython-34.py
  97. c
  98. File "build\bdist.win32\egg\xlutils\margins.py", line 70
  99. print fname
  100. ^
  101. SyntaxError: Missing parentheses in call to 'print'
  102. byte-compiling build\bdist.win32\egg\xlutils\save.py to save.cpython-34.pyc
  103. byte-compiling build\bdist.win32\egg\xlutils\styles.py to styles.cpython-34.pyc
  104. byte-compiling build\bdist.win32\egg\xlutils\tests\fixtures.py to fixtures.cpyth
  105. on-34.pyc
  106. byte-compiling build\bdist.win32\egg\xlutils\tests\test_copy.py to test_copy.cpy
  107. thon-34.pyc
  108. byte-compiling build\bdist.win32\egg\xlutils\tests\test_docs.py to test_docs.cpy
  109. thon-34.pyc
  110. byte-compiling build\bdist.win32\egg\xlutils\tests\test_filter.py to test_filter
  111. .cpython-34.pyc
  112. byte-compiling build\bdist.win32\egg\xlutils\tests\test_save.py to test_save.cpy
  113. thon-34.pyc
  114. byte-compiling build\bdist.win32\egg\xlutils\tests\test_styles.py to test_styles
  115. .cpython-34.pyc
  116. byte-compiling build\bdist.win32\egg\xlutils\tests\test_view.py to test_view.cpy
  117. thon-34.pyc
  118. byte-compiling build\bdist.win32\egg\xlutils\tests\__init__.py to __init__.cpyth
  119. on-34.pyc
  120. byte-compiling build\bdist.win32\egg\xlutils\view.py to view.cpython-34.pyc
  121. byte-compiling build\bdist.win32\egg\xlutils\__init__.py to __init__.cpython-34.
  122. pyc
  123. creating build\bdist.win32\egg\EGG-INFO
  124. copying xlutils.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
  125. copying xlutils.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
  126. copying xlutils.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
  127. copying xlutils.egg-info\entry_points.txt -> build\bdist.win32\egg\EGG-INFO
  128. copying xlutils.egg-info\not-zip-safe -> build\bdist.win32\egg\EGG-INFO
  129. copying xlutils.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
  130. copying xlutils.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
  131. creating 'dist\xlutils-1.7.1-py3.4.egg' and adding 'build\bdist.win32\egg' to it
  132. removing 'build\bdist.win32\egg' (and everything under it)
  133. Processing xlutils-1.7.1-py3.4.egg
  134. creating c:\python34\lib\site-packages\xlutils-1.7.1-py3.4.egg
  135. Extracting xlutils-1.7.1-py3.4.egg to c:\python34\lib\site-packages
  136. File "c:\python34\lib\site-packages\xlutils-1.7.1-py3.4.egg\xlutils\filter.py"
  137. , line 699
  138. print repr(self.name),
  139. ^
  140. SyntaxError: invalid syntax
  141. File "c:\python34\lib\site-packages\xlutils-1.7.1-py3.4.egg\xlutils\margins.py
  142. ", line 70
  143. print fname
  144. ^
  145. SyntaxError: Missing parentheses in call to 'print'
  146. Removing xlutils 0.0.0 from easy-install.pth file
  147. Adding xlutils 1.7.1 to easy-install.pth file
  148. Installing margins-script.py script to C:\Python34\Scripts
  149. Installing margins.exe script to C:\Python34\Scripts
  150. Installing margins.exe.manifest script to C:\Python34\Scripts
  151. Installed c:\python34\lib\site-packages\xlutils-1.7.1-py3.4.egg
  152. Processing dependencies for xlutils==1.7.1
  153. Searching for xlwt-future==0.8.0
  154. Best match: xlwt-future 0.8.0
  155. Processing xlwt_future-0.8.0-py3.4.egg
  156. xlwt-future 0.8.0 is already the active version in easy-install.pth
  157. Using c:\python34\lib\site-packages\xlwt_future-0.8.0-py3.4.egg
  158. Searching for xlrd==0.9.3
  159. Best match: xlrd 0.9.3
  160. Adding xlrd 0.9.3 to easy-install.pth file
  161. Using c:\python34\lib\site-packages
  162. Searching for future==0.14.3
  163. Best match: future 0.14.3
  164. Processing future-0.14.3-py3.4.egg
  165. future 0.14.3 is already the active version in easy-install.pth
  166. Installing futurize-script.py script to C:\Python34\Scripts
  167. Installing futurize.exe script to C:\Python34\Scripts
  168. Installing futurize.exe.manifest script to C:\Python34\Scripts
  169. Installing pasteurize-script.py script to C:\Python34\Scripts
  170. Installing pasteurize.exe script to C:\Python34\Scripts
  171. Installing pasteurize.exe.manifest script to C:\Python34\Scripts
  172. Using c:\python34\lib\site-packages\future-0.14.3-py3.4.egg
  173. Finished processing dependencies for xlutils==1.7.1
  174. D:\下载夹\xlutils-1.7.1\xlutils-1.7.1>
尽管仍然出现了一些小的错误,但是安装总算顺利的安装完毕,这些错误是小错误,不会中断,只是影响print或者什么小的函数而已。

版权声明:
作者:xinyu2ru
链接:https://www.rxx0.com/motion/an-zhuang-xlutils-yu-dao-di-cuo-wu.html
来源:RUBLOG-分享我的生活
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>