问题描述
我已经下载了源代码并尝试通过README说明进行安装:
sudo make install
但出现以下错误:
python setup.py build
running build
running build_mo
warning: hgbuildmo: could not find msgfmt executable, no translations will be built
running build_py
running build_ext
building 'mercurial.base85' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c mercurial/base85.c -o build/temp.linux-x86_64-2.6/mercurial/base85.o
mercurial/base85.c:12:20: error: Python.h: No such file or directory
mercurial/base85.c: In function ‘b85prep’:
mercurial/base85.c:23: warning: implicit declaration of function ‘memset’
mercurial/base85.c:23: warning: incompatible implicit declaration of built-in function ‘memset’
mercurial/base85.c: At top level:
mercurial/base85.c:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
mercurial/base85.c:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
mercurial/base85.c:147: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
mercurial/base85.c:156: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initbase85’
error: command 'gcc' failed with exit status 1
make: *** [build] Error 1
请记住,我知道我可以使用以下方法安装:
sudo apt-get install mercurial
但这给了我一个旧版本(1.4.3-1)。
发生什么了?
最佳方法
从该行:
mercurial/base85.c:12:20: error: Python.h: No such file or directory
似乎您没有python的开发工具。解决:
sudo apt-get install python-dev
次佳方法
您无需手动构建Mercurial即可在Ubuntu上获得最新版本。 https://launchpad.net/~mercurial-ppa/+archive/releases处有一个PPA存储库
sudo add-apt-repository ppa:mercurial-ppa/releases
sudo apt-get update
sudo apt-get install mercurial
顺便说说。还有一个用于TortoiseHG的PPA,它在Nautilus中提供了很好的Mercurial功能集成:https://launchpad.net/~tortoisehg-ppa/+archive/releases
sudo add-apt-repository ppa:tortoisehg-ppa/releases
sudo apt-get update
sudo apt-get install tortoisehg-nautilus