以前第一次編譯的時候沒有出現問題,第二次從新編譯時./configure報錯:python
File "/usr/lib/python2.7/posixpath.py", line 73, in join path += '/' + b UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 13: ordinal not in range(128)
查知可在報錯的文件/usr/lib/python/posixpath.py中添加語句python3.x
import sys reload(sys) sys.setdefaultencoding('utf-8')
解決;python2.7
但configure時再次出現相似報錯ui
File "/usr/lib/python2.7/codecs.py", line 896, in open file = __builtin__.open(filename, mode, buffering) UnicodeEncodeError: 'ascii' codec can't encode characters in position 13-14: ordinal not in range(128)
在/usr/lib/python2.7/codecs.py中添加上述setdefaultencoding('utf-8')語句,configure時出現另外一種報錯:spa
File "/usr/lib/python2.7/codecs.py", line 13, in <module> sys.setdefaultencoding('utf-8') LookupError: no codec search functions registered: can't find encoding
因此,這樣搞下去沒完沒了,是不行的啦…….net
因爲有以前(勇於做死)的經驗,我知道將系統的默認python版本從原來的2.7連接到3.0就能夠解決這個問題。具體操做可參考這篇文章:Linux升級Python至3.x code
但我還有一些補充:blog
1. 若是/usr/bin下已有python3.x的話,建議直接將usr/bin/python軟連接到/usr/bin/python3.x(這裏個人系統裏存的是3.5)。(而不是連接到從源碼編譯安裝獲得的/usr/local/bin下的python3.x)utf-8
# mv /usr/bin/python /usr/bin/python.bak # ln -s /usr/bin/python3.5 /usr/bin/python
2. pqxx編譯安裝結束後建議將usr/bin/python軟連接回/usr/bin/python2.7(恢復原先狀態)【以避免將來出現一些不可控的情況(血淚的教訓.jpgci
# mv /usr/bin/python /usr/bin/python.bak # ln -s /usr/bin/python2.7 /usr/bin/python