当前位置:   article > 正文

python 常见bug解决方案记录_valueerror: unknown locale: en-us

valueerror: unknown locale: en-us
1.https://picasso.readthedocs.io/en/latest/readme.html#quickstart
python picasso/examples/keras-vgg16/prepare_model.py

Error:

from keras.applications.vgg16 import VGG16

ImportError: No module named 'keras'


分析:
如果是已经安装了keras之后还出现上面bug,很有可能是start了python2的。python2.x和python3.x出现了混乱。

解决方法:
      
python3 picasso/examples/keras-vgg16/prepare_model.py

二、ValueError: unknown locale: UTF-8

File "/Users/wyl/Documents/effectmatrix/program/minetest/MCEdit-Unified-master/ENV/lib/python2.7/locale.py", line 545, in getdefaultlocale

    return _parse_localename(localename)

  File "/Users/wyl/Documents/effectmatrix/program/minetest/MCEdit-Unified-master/ENV/lib/python2.7/locale.py", line 477, in _parse_localename

    raise ValueError, 'unknown locale: %s' % localename

ValueError: unknown locale: UTF-8

解决方法:

1.在.bash_profile文件中加入 

export LANG="en_US.UTF-8"

export LC_COLLATE="en_US.UTF-8"

export LC_CTYPE="en_US.UTF-8"

export LC_MESSAGES="en_US.UTF-8"

export LC_MONETARY="en_US.UTF-8"

export LC_NUMERIC="en_US.UTF-8"

export LC_TIME="en_US.UTF-8"

2.source 使用更新后的内容

source .bash_profile

测试

python -c 'import locale; print(locale.getdefaultlocale());'

 
 

参考资料

1.ValueError: unknown locale: UTF-8 http://blog.csdn.net/fivekm/article/details/50732742

2.unknown locale: UTF-8解决方法 http://ju.outofmemory.cn/entry/107663

3.mac 下更新 .bash_profile 文件 http://www.cnblogs.com/mokey/p/3542389.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/103902
推荐阅读
相关标签
  

闽ICP备14008679号