簡體   English   中英

如何在Mac上使用PyPy?

[英]How to use PyPy on a Mac?

PyPy的速度承諾讓我想嘗試一下。 不幸的是,我在這個主題上閱讀的教程都沒有真正幫助我理解基礎知識,即如何(簡單的步驟):

  • 在Mac上安裝PyPy
  • 運行.py腳本

我讀到從bin/中下載,提取和運行pypy myscript.py應該可以做到這一點,但到目前為止我沒有運氣。 這是我得到的:

MyMacbook:bin User$ pypy myscript.py
-bash: pypy: command not found

任何人都可以幫我理解PyPy的基本用法嗎?

你嘗試過使用自制軟件( http://brew.sh/ )嗎?

~ $ brew search pypy
pypy

看起來像“釀造安裝pypy”應該讓你到那里。

~ $ brew versions pypy
Warning: brew-versions is unsupported and may be removed soon.
Please use the homebrew-versions tap instead:
https://github.com/Homebrew/homebrew-versions
2.2.0    git checkout 4d471b1 /usr/local/Library/Formula/pypy.rb
2.1.0    git checkout ff5dd19 /usr/local/Library/Formula/pypy.rb
2.0.2    git checkout 58b36e9 /usr/local/Library/Formula/pypy.rb
2.0.1    git checkout 82b72d3 /usr/local/Library/Formula/pypy.rb
2.0      git checkout 280581d /usr/local/Library/Formula/pypy.rb
1.9      git checkout 28557b8 /usr/local/Library/Formula/pypy.rb
1.8      git checkout 93bda7d /usr/local/Library/Formula/pypy.rb
1.7      git checkout eee60ad /usr/local/Library/Formula/pypy.rb
1.6.0    git checkout b9b1f35 /usr/local/Library/Formula/pypy.rb
1.5.0    git checkout d0c75a9 /usr/local/Library/Formula/pypy.rb
1.4.1    git checkout 46c553a /usr/local/Library/Formula/pypy.rb
1.4      git checkout 61dd587 /usr/local/Library/Formula/pypy.rb
1.3      git checkout a546a1f /usr/local/Library/Formula/pypy.rb
1.2      git checkout 89de8bb /usr/local/Library/Formula/pypy.rb

編輯:或者您是否已檢查是否已將安裝放在路徑上? 例如,我抓住它並將其放入我的主目錄。

~ $ ll ~/ | grep pypy
drwxr-xr-x@  9 squiddly  staff    306 Nov 27 07:42 pypy-2.2.1-osx64

然后在我的.bash_profile中我將以下行放入:

# Put pypy on my path
PATH=$PATH:$HOME/pypy-2.2.1-osx64/bin
export PATH

現在我可以從任何地方運行pypy~ / scripts / test.py。

----編輯2 ----回答有關丟失包裹的最后一個問題:

“如果你想安裝第三方庫,最方便的方法是安裝distribute和pip:”

$ curl -O http://python-distribute.org/distribute_setup.py
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ ./pypy-2.1/bin/pypy distribute_setup.py
$ ./pypy-2.1/bin/pypy get-pip.py
$ ./pypy-2.1/bin/pip install pygments  # for example

“第三方庫將安裝在pypy-2.1 / site-packages中,而腳本將安裝在pypy-2.1 / bin中”

- 從這里: http//doc.pypy.org/en/latest/getting-started.html#installing-pypy

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM