One - One Code All

Blog Content

pypy的安装和使用

Python   2018-03-01 00:53:05

使用文档:http://doc.pypy.org/en/latest/install.html 

pypy的安装:
官网下载对应的安装包:
http://pypy.org/download.html   
https://bitbucket.org/pypy/pypy/downloads/

解压放到指定目录,

pip的安装:

https://github.com/anpengapple/pypy_get_pip 
https://raw.githubusercontent.com/anpengapple/pypy_get_pip/master/get-pip.py 


进入bin目录:
wget https://bootstrap.pypa.io/get-pip.py 
./pypy3 get_pip.py

ubuntu安装:

参考:https://askubuntu.com/questions/441981/how-to-install-pypy3-on-ubuntu-for-newbies 

sudo apt-get install gcc make python-dev libffi-dev libsqlite3-dev 
pkg-config libz-dev libbz2-dev libncurses-dev libexpat1-dev libssl-dev 
libgc-dev python-sphinx python-greenlet openssl

wget https://bitbucket.org/pypy/pypy/downloads/pypy3-v6.0.0-linux64.tar.bz2
tar jxvf pypy3-v6.0.0-linux64.tar.bz2
mv pypy3-v6.0.0-linux64 /opt/pypy3
ln -s /opt/pypy3/bin/pypy3 /usr/local/bin/pypy3


ubuntu安装libssl-devel

apt-get install aptitude
apt-get install openssl libssl  
aptitude libssl-dev


apt-get安装时会默认选择预设的依赖版本。
aptitude安装时会提示是否选择默认设定的依赖版本,如果选n,会对库进行依赖降级,从而安装期望的版本。


mac自动安装pypy

brew search pypy
brew install pypy3

安装末尾:

libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find libffi you may need to set:
  export LDFLAGS="-L/usr/local/opt/libffi/lib"

==> pypy3
A "distutils.cfg" has been written to:
  /usr/local/opt/pypy3/libexec/lib-python/3/distutils
specifying the install-scripts folder as:
  /usr/local/share/pypy3

If you install Python packages via "pypy3 setup.py install", easy_install_pypy3,
or pip_pypy3, any provided scripts will go into the install-scripts folder
above, so you may want to add it to your PATH *after* /usr/local/bin
so you don't overwrite tools from CPython.

Setuptools and pip have been installed, so you can use easy_install_pypy3 and
pip_pypy3.
To update pip and setuptools between pypy3 releases, run:
    pip_pypy3 install --upgrade pip setuptools

See: https://docs.brew.sh/Homebrew-and-Python


root权限安装packages

sudo su -

numpy的安装:

参考官网:http://pypy.org/download.html

./pypy-xxx/bin/pip install cython numpy
pypy -m pip install git+https://bitbucket.org/pypy/numpy.git


Alternatively, the direct way:

git clone https://bitbucket.org/pypy/numpy.git
cd numpy
pypy setup.py install


If you installed to a system directory, you need to also run this once:

sudo pypy -c 'import numpy'


执行安装:

pypy3 -m pip install cython numpy  scipy

pypy3 numpy安装报错,错误信息:

File "numpy/core/setup.py", line 666, in get_mathlib_info
        raise RuntimeError("Broken toolchain: cannot link a simple C program")
    RuntimeError: Broken toolchain: cannot link a simple C program


解决:安装 xcode command line tool

macos安装xcode command line tool的两种方法:
Terminal 运行 xcode-select --install 然后点击安装
登录https://developer.apple.com/download/more/   然后下载 dmg 安装

安装好后,在系统设置点软件更新,将系统更新到最新,重启。就可以安装了。




上一篇:Mac双屏显示时,如何把dock固定在主屏幕?
下一篇:chromedriver下载地址及Mac下安装方法

The minute you think of giving up, think of the reason why you held on so long.