蟒蛇Python2.7
Ubuntu16.04 LTS
通过以下方式安装Brightway2时出现 UnicodeEncodeError :
pip install brightway2
UnicodeEncondeError:
Collecting brightway2
Using cached brightway2-2.0.2.tar.gz
Collecting appdirs (from brightway2)
Downloading appdirs-1.4.1-py2.py3-none-any.whl
Collecting asteval (from brightway2)
Using cached asteval-0.9.8.tar.gz
Collecting bw2analyzer>=0.9 (from brightway2)
Using cached bw2analyzer-0.9.1.tar.gz
Collecting bw2calc>=1.2.1 (from brightway2)
Using cached bw2calc-1.5.3.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/bw2calc.egg-info
writing requirements to pip-egg-info/bw2calc.egg-info/requires.txt
writing pip-egg-info/bw2calc.egg-info/PKG-INFO
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-ikaXlZ/bw2calc/setup.py", line 33, in <module>
'Topic :: Scientific/Engineering :: Visualization',
File "/home/runsheng/anaconda2/envs/tensorflow/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/home/runsheng/anaconda2/envs/tensorflow/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/home/runsheng/anaconda2/envs/tensorflow/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/runsheng/anaconda2/envs/tensorflow/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 272, in run
writer(self, ep.name, os.path.join(self.egg_info, ep.name))
File "/home/runsheng/anaconda2/envs/tensorflow/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 600, in write_pkg_info
metadata.write_pkg_info(cmd.egg_info)
File "/home/runsheng/anaconda2/envs/tensorflow/lib/python2.7/distutils/dist.py", line 1106, in write_pkg_info
self.write_pkg_file(pkg_info)
File "/home/runsheng/anaconda2/envs/tensorflow/lib/python2.7/site-packages/setuptools/dist.py", line 51, in write_pkg_file
file.write('License: %s\n' % self.get_license())
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 50: ordinal not in range(128)
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ikaXlZ/bw2calc/
它只发生在 Python2.7 下。当我切换到 Python3.5 时,错误消失了,brightway2 工作正常。
我已经安装了ftfy和8来翻译 Python2.7 和 Python3 之间的代码。