Mat*_*kin 13 python macos mercurial osx-snow-leopard
我使用以下内容从源代码在Mac OS X 10.6 Snow Leopard上安装了Mercurial 1.3.1:
cd ~/src
curl -O https://www.mercurial-scm.org/release/mercurial-1.3.1.tar.gz
tar -xzvf mercurial-1.3.1.tar.gz
cd mercurial-1.3.1
make all
sudo make install
Run Code Online (Sandbox Code Playgroud)
这将安装Mercurial的站点包文件/usr/local/lib/python2.6/site-packages/.我知道从Mac Disk Image安装Mercurial会将文件安装到/Library/Python/2.6/site-packages/,这是Mac OS X默认Python安装的site-packages目录.
我将Python 2.6.2+作为Framework安装,其site-packages目录位于:
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
以这种方式安装Mercurial,我必须发出:
PYTHONPATH =在/ usr/local/lib目录/ python2.6的/站点包: "$ {PYTHONPATH}"
为了让Mercurial工作.
Wil*_*ung 13
为什么需要使用macports?python easy_install是最简单的方法,没有错误:
easy_install -U mercurial
Run Code Online (Sandbox Code Playgroud)
它一直只是一个简单的金子弹.
特别是因为你有Python 2.6可用,你可以做类似的事情python setup.py install --user,它将使用〜/ .local作为前缀安装Mercurial.您不必为此更改PYTHONPATH,而只需将〜/ .local/bin添加到PATH中.
关于优点和缺点:这一切都取决于你的PYTHONPATH一般看起来是什么样的,因为修改它会自然地修改包的加载顺序(如果你有一个版本的Mercurial安装了一个前缀而另一个版本带有不同的前缀,那么它就变得相关).通常,我尝试将所有自定义包放入某个site-packages文件夹(例如/usr/local/lib/python2.6/site-packages).再说一遍:如果你是唯一一个使用这些库的人,那么Python 2.6的distutils提供的--user标志就可以很容易了(将〜/ .local添加到模块的默认搜索路径中).
只要你一直使用PYTHONPATH,virtualenv应该可以正常工作.
将mercurial(或任何Python包)安装到用户主目录中.因此,您可以从任何Python(相同版本)或任何virtualenv访问它们.有关详细信息,请参阅PEP 370.
$ cd mercurial-x.y.z/
$ python2.6 setup.py install --user
$ ~/.local/bin/hg
...
Run Code Online (Sandbox Code Playgroud)
但是你为什么要手动建立mercurial?我用macports.
$ sudo port install mercurial
$ which hg
/opt/local/bin/hg
Run Code Online (Sandbox Code Playgroud)
更新:现在,我只是使用PyPM来安装mercurial ~/.local/bin/hg.
正如Sridhar所建议的那样,macports在多种架构上运行良好,MacOsX +版本允许更新等等:
$ port variants mercurial
mercurial has the variants:
bash_completion: Completion support for bash
zsh_completion: Install mercurial zsh completion file
$
Run Code Online (Sandbox Code Playgroud)
这样你就可以使用:
$ sudo port install mercurial +bash_completion
---> Computing dependencies for mercurial
---> Fetching mercurial
---> Attempting to fetch mercurial-1.3.1.tar.gz from http://arn.se.distfiles.macports.org/python
---> Attempting to fetch mercurial-1.3.1.tar.gz from http://www.selenic.com/mercurial/release/
---> Verifying checksum(s) for mercurial
---> Extracting mercurial
---> Configuring mercurial
---> Building mercurial
---> Staging mercurial into destroot
---> Installing mercurial @1.3.1_0+bash_completion
---> Activating mercurial @1.3.1_0+bash_completion
---> Cleaning mercurial
$
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18666 次 |
| 最近记录: |