删除python2.7后mkvirtualenv不工作

2024-05-05 17:29:52 发布

您现在位置:Python中文网/ 问答频道 /正文

在我从笔记本电脑上删除python2.7之后,我开始出现这个错误。 我正在尝试使用/bin/easy_install创建具有virtualenvwrappermkvirtualenv的虚拟环境。
我试过这个命令

╭─ fsadykov ~
╰─() mkvirtualenv --python=`which python` example

这个呢

╭─ fsadykov ~
╰─()  mkvirtualenv  example                                                                                                                                              1 ↵
New python executable in /Users/fsadykov/virtualenvs/example/bin/python
Please make sure you remove any previous custom paths from your /Users/fsadykov/.pydistutils.cfg file.
Installing setuptools, pip, wheel...

  Complete output from command /Users/fsadykov/virt...s/example/bin/python - setuptools pip wheel:
  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.
Looking in links: /Library/Python/2.7/site-packages/virtualenv_support
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl
Collecting pip
  Using cached https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
Installing collected packages: setuptools, pip, wheel
Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted: '/bin/easy_install'

----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 10, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 810, in main
    symlink=options.symlink,
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1105, in create_environment
    install_wheel(to_install, py_executable, search_dirs, download=download)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 952, in install_wheel
    _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1042, in _install_wheel_with_search_dir
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 903, in call_subprocess
    raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command /Users/fsadykov/virt...s/example/bin/python - setuptools pip wheel failed with error code 1

版本

VirtualEnvrapper版本

╭─ fsadykov ~
╰─() mkvirtualenv --version                                                              
16.4.0

Python版本

╭─ fsadykov ~
╰─() python --version
Python 3.7.4

我想从我的MacBookPro中删除python2.7,如果它是可行的并且可以用于python3.7的所有东西。但由于某种原因,我得到了这个错误。你知道吗

注意:此文件不存在/bin/easy_install

Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted: '/bin/easy_install'

Tags: installpipinpybinvirtualenvexamplepackages