在 Ubuntu 上创建虚拟环境

在 Ubuntu 上创建虚拟环境

我按照说明创建了虚拟环境,但无法正常工作。我认为它想安装 pip,但某些设置阻止了它?如能提供任何帮助,我将不胜感激!

以下是我正在做的事情:

pyenv virtualenv my_first_env # create an environment

这是我收到的错误:

equirement already satisfied: virtualenv in ./.local/lib/python2.7/site-packages (16.5.0)
pyenv: virtualenv: command not found
ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules For the system python are usually handled by dpkg and apt-get.

    apt-get install python-<module name>

Install the python-pip package to use pip itself.  Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.

Installing pip from https://bootstrap.pypa.io/get-pip.py...
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pip
  Using cached https://files.pythonhosted.org/packages/f9/fb/863012b13912709c13cf5cfdbfb304fa6c727659d6290438e1a88df9d848/pip-19.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/bin/pip'
Consider using the `--user` option or check the permissions.

error: failed to install pip via get-pip.py

额外细节:

pyenv install 3.7.3
(Doesn't install.)

皮耶恩夫:

pyenv --version
pyenv 1.2.11

Python:

python --version
Python 2.7.16

点:

pip --version
pip 18.1

虚拟环境:

pip install virtualenv
Requirement already satisfied: virtualenv in ./.local/lib/python2.7/site-packages (16.5.0)

相关内容