简体   繁体   中英

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.

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.

For example, if I try to install bpython into environment named gdr with Python 3.8.10 :

(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. 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. There are no more operating system-dependent installations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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