[英]How to use a Python interpreter in a virtual environment
In Linux Mint distro I have installed pyenv
and pyenv-virtualenv
so I can activate and deactivate an environment with a given Python version.在 Linux Mint 发行版中,我安装了
pyenv
和pyenv-virtualenv
,因此我可以激活和停用具有给定 Python 版本的环境。
I would like to use bpython
or ipython
interpreters with an environment but I only can install them with sudo install bpython
and not with pip
into the environment.我想在环境中使用
bpython
或ipython
解释器,但我只能使用sudo install bpython
安装它们,而不能使用pip
安装到环境中。
For example, if I try to install bpython
into environment named gdr
with Python 3.8.10 :例如,如果我尝试使用 Python 3.8.10 将
bpython
安装到名为gdr
的环境中:
(gdr) lab@GdRlab:~/Documents/prPy1$ pip install bpython
Collecting bpython
Using cached bpython-0.22.1-py3-none-any.whl (187 kB)
Collecting pygments
Using cached Pygments-2.12.0-py3-none-any.whl (1.1 MB)
Collecting cwcwidth
Using cached cwcwidth-0.1.6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (52 kB)
Collecting pyxdg
Using cached pyxdg-0.28-py2.py3-none-any.whl (49 kB)
Collecting requests
Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting typing-extensions
Downloading typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting curtsies>=0.3.5
Using cached curtsies-0.3.10.tar.gz (53 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [67 lines of output]
running dist_info
creating /tmp/pip-modern-metadata-r6sz4vv0/curtsies.egg-info
writing /tmp/pip-modern-metadata-r6sz4vv0/curtsies.egg-info/PKG-INFO
......
The above output does not give much information on how to solve it.上面的输出没有提供太多关于如何解决它的信息。
I have always used miniconda (or anaconda), on any operating system.我一直在任何操作系统上使用 miniconda(或 anaconda)。 It works very well as an all-in-one solution for managing Python interpreters, libraries, pip installations, and generally everything related to the virtual environment.
它非常适合作为管理 Python 解释器、库、pip 安装以及通常与虚拟环境相关的所有内容的一体化解决方案。 There are no more operating system-dependent installations.
不再有依赖于操作系统的安装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.