简体   繁体   English

如何在 anaconda 中安装 PyPy

[英]How to install PyPy in anaconda

I have a Linux-64 bit machine.我有一台 Linux-64 位机器。 How do I install PyPy in my anaconda environment.如何在我的 anaconda 环境中安装 PyPy。 I tried conda install pypy.我试过 conda install pypy。 It says there are no available packages.它说没有可用的包。 pip install pypy also returns a similar message. pip install pypy 也会返回类似的消息。 Is it that the only way to install PyPy is by downloading the tar.gz file from the website?安装 PyPy 的唯一方法是从网站下载 tar.gz 文件吗? Once installed, how do I configure my Anaconda environment in such a way so as to be able to switch from PyPy to other Python implementations when required?安装后,如何配置我的 Anaconda 环境以便能够在需要时从 PyPy 切换到其他 Python 实现?

conda-forge now supports PyPy3.6 as the python interpreter in a conda environment (see the official blog post ): conda-forge 现在支持 PyPy3.6 作为 conda 环境中的 python 解释器(参见官方博客文章):

conda config --set channel_priority strict
conda create -n pypy pypy
conda activate pypy

And then use it like your regular python executable (notice that this is a different Python interpreter, not a package)然后像您的常规python可执行文件一样使用它(请注意,这是一个不同的 Python 解释器,而不是一个包)

pypy3 -c "import sys; print(sys.version)"

It works on Linux and OSX.它适用于 Linux 和 OSX。

NOTE : conda-pypy is archived, this answer outdated, and conda-forge is in the process of producing PyPy packages.注意:conda-pypy 已存档,此答案已过时,并且 conda-forge 正在生成 PyPy 包。 You should use that instead.你应该改用它。

There is an alternative approach maintained by Riccardo Vianello on GitHub: Riccardo Vianello 在 GitHub 上维护了另一种方法:

https://github.com/rvianello/conda-pypy https://github.com/rvianello/conda-pypy

It basically involves using his conda channel instead of the default one to install necessary packages.它基本上涉及使用他的 conda 频道而不是默认频道来安装必要的软件包。 Some basic ones are provided.提供了一些基本的。

In addition to Ohad's answer, create a new environment to house pypy first.除了 Ohad 的回答,首先创建一个新环境来容纳 pypy。 PyPy wouldn't install for my base configuration but did this way: PyPy 不会为我的基本配置安装,而是这样做:

conda create -n <newenviromnentname>

Enter the enviromnent进入环境

conda activate <newenviromnentname>

install pypy to the environment安装pypy到环境

conda install -c conda-forge pypy3.6 

Then proceed to install the rest of the packages you need available.然后继续安装您需要的其余软件包。

As of 2021 Pypy 3.7 supports Python 3.7 go to conda environment Type> conda install -c conda-forge pypy3.7 (Ensure you are on py 3.7)截至 2021 年,Pypy 3.7 支持 Python 3.7 转到 conda 环境类型> conda install -c conda-forge pypy3.7(确保您使用的是 py 3.7)

(pypy37) C:\Users\UserName>conda install -c conda-forge pypy3.7
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.10.1
  latest version: 4.10.3

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: C:\Users\Dios Dole\.conda\envs\pypy37

  added / updated specs:
    - pypy3.7


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    bzip2-1.0.8                |       h8ffe710_4         149 KB  conda-forge
    ca-certificates-2021.5.30  |       h5b45459_0         171 KB  conda-forge
    certifi-2021.5.30          |   py37h4c0cbd9_0         142 KB  conda-forge
    expat-2.4.1                |       h39d44d4_0         279 KB  conda-forge
    libffi-3.3                 |       h0e60522_2          37 KB  conda-forge
    openssl-1.1.1k             |       h8ffe710_0         5.7 MB  conda-forge
    pypy3.7-7.3.5              |       hb504520_5        31.1 MB  conda-forge
    python-3.7.10              |        1_73_pypy           5 KB  conda-forge
    python_abi-3.7             |    2_pypy37_pp73           4 KB  conda-forge
    tk-8.6.10                  |       h8ffe710_1         3.2 MB  conda-forge
    xz-5.2.5                   |       h62dcd97_1         211 KB  conda-forge
    zlib-1.2.11                |    h62dcd97_1010         126 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        41.2 MB

The following NEW packages will be INSTALLED:

  bzip2              conda-forge/win-64::bzip2-1.0.8-h8ffe710_4
  expat              conda-forge/win-64::expat-2.4.1-h39d44d4_0
  libffi             conda-forge/win-64::libffi-3.3-h0e60522_2
  pypy3.7            conda-forge/win-64::pypy3.7-7.3.5-hb504520_5
  python_abi         conda-forge/win-64::python_abi-3.7-2_pypy37_pp73
  tk                 conda-forge/win-64::tk-8.6.10-h8ffe710_1
  xz                 conda-forge/win-64::xz-5.2.5-h62dcd97_1
  zlib               conda-forge/win-64::zlib-1.2.11-h62dcd97_1010

The following packages will be UPDATED:

  python                pkgs/main::python-3.7.10-h6244533_0 --> conda-forge::python-3.7.10-1_73_pypy

The following packages will be SUPERSEDED by a higher-priority channel:

  ca-certificates    pkgs/main::ca-certificates-2021.7.5-h~ --> conda-forge::ca-certificates-2021.5.30-h5b45459_0
  certifi            pkgs/main::certifi-2021.5.30-py37haa9~ --> conda-forge::certifi-2021.5.30-py37h4c0cbd9_0
  openssl              pkgs/main::openssl-1.1.1k-h2bbff1b_0 --> conda-forge::openssl-1.1.1k-h8ffe710_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
ca-certificates-2021 | 171 KB    | ####################################################################################################################################################################### | 100%
python_abi-3.7       | 4 KB      | ####################################################################################################################################################################### | 100%
python-3.7.10        | 5 KB      | ####################################################################################################################################################################### | 100%
expat-2.4.1          | 279 KB    | ####################################################################################################################################################################### | 100%
certifi-2021.5.30    | 142 KB    | ####################################################################################################################################################################### | 100%
bzip2-1.0.8          | 149 KB    | ####################################################################################################################################################################### | 100%
libffi-3.3           | 37 KB     | ####################################################################################################################################################################### | 100%
tk-8.6.10            | 3.2 MB    | ####################################################################################################################################################################### | 100%
xz-5.2.5             | 211 KB    | ####################################################################################################################################################################### | 100%
zlib-1.2.11          | 126 KB    | ####################################################################################################################################################################### | 100%
pypy3.7-7.3.5        | 31.1 MB   | ####################################################################################################################################################################### | 100%
openssl-1.1.1k       | 5.7 MB    | ####################################################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

After that to check Type> pypy --version之后检查类型> pypy --version

(pypy37) C:\Users\UserName>pypy --version
Python 3.7.10 (77787b8f4c49115346d1e9cbaf48734137417738, Jul 18 2021, 08:38:15)
[PyPy 7.3.5 with MSC v.1916 64 bit (AMD64)]

Puppy's version support can found here: http://pypy.org/download.html . Puppy 的版本支持可以在这里找到: http : //pypy.org/download.html

It is distributed specific, so if you don't have a supported district you can.它是特定分布的,因此如果您没有受支持的地区,则可以。 Try using the build option.尝试使用构建选项。

Without more info on your Linux and python versions, it is hard to add more.如果没有关于您的 Linux 和 python 版本的更多信息,就很难添加更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM