OSx更新后如何修复损坏的python 2.7.11 [英] How to fix broken python 2.7.11 after OSx updates

查看:220
本文介绍了OSx更新后如何修复损坏的python 2.7.11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OSx更新并安装了新版本的python 2.7之后,我的virtualevn环境完全崩溃了,因此我很难进行修复.我不确定是什么原因导致的,并经历了我所做的一整套工作,并初步阅读了以下内容没有用.答案部分提供了解决我问题的方法.

After an OSx update and installing a new version of python 2.7 my virtualevn environment completely broke and I struggled in fixing it. I wasn't sure what caused it and went through a whole set of things that I did and read initially that didn't work are listed below. What solved my problem is provided in the answer section.

  • 通过自制软件安装python,然后使用pip安装virtualenv
  • 通过 https://www.python.org 安装python,然后使用pip安装virtualenv
  • Installed python through homebrew and then used pip to install virtualenv
  • Installed python through https://www.python.org and then used pip to install virtualenv

对我有帮助但未提供解决方案的相关问题:

Related questions that helped me but did not provide the solution to my problem:

  1. ​​ virtualenv-command-not-found
  2. ​​ virtualenv-workon-command-not-found
  1. virtualenv-command-not-found
  2. virtualenv-workon-command-not-found

我完成了完整的手动恢复(不要做什么!):

这并不能完全解决我的问题.只是为了让您了解在找到在OSx上修复python开发环境的正确方法之前我经过了哪些步骤.

Complete manual recovery I went through (What not to do!):

This didn't completely solved my problem. It is just to give you an idea of what steps I went through before I found the correct way to fix my python dev environment on my OSx.

  • Removed python 2.7 by using the post in here
  • Removed the homebrew installed version
  • Installed python through the pkg file in Mac OS X 32-bit i386/PPC installer or Mac OS X 64-bit/32-bit installer
  • Manually installed virtualenv following the instructions from here:

 curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-13.1.2.tar.gz
 tar xvfz virtualenv-13.1.2.tar.gz 
 cd virtualenv-13.1.2 
 sudo python setup.py install

  • 通过 https://bootstrap.pypa.io/get-pip.py |须藤python2.7

  • Manaully install pip through 7: curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7

    在创建了虚拟环境之后,我的pip仍然将软件包安装在主python文件夹中,而不是在虚拟环境和非线程提供了帮助.我的解决方案是在虚拟环境下使用以下选项运行pip: 1-激活虚拟环境,以便设置$VIRTUAL_ENV:

    After all this after creating a virtual environment my pip still installed the packages in the main python folder instead of installing them under the virtual environment and non of the threads here neither here helped. My solution to that was to run pip under my virtual env with the following options: 1- Activate the virtual environment so that $VIRTUAL_ENV is set:

    source venv/bin/activate
    

    2-强制将pip安装在正确的目的地:

    2- Forces pip to install in the right destination:

    pip install --target=$VIRTUAL_ENV/lib/python2.7/site-packages   
    

    摘要

    此问题已被严重破坏,并且在此问题的答案中提供了修复我的开发环境的最佳方法.

    Summary

    Something was badly broken and best way I fix my dev environment is provided in the answer to this question.

    推荐答案

    原因

    就我而言,是OSx升级影响了我的自制软件,并且在升级到python 2.7.11之后没有正确安装它.

    The reason

    In my case was an OSx upgrade that affected my homebrew and after upgrading to python 2.7.11 is didn't install it properly.

    我在线程此处中找到了第3步和第4步,非常感谢 https://github.com/baronomasia .

    I found steps 3 and 4 in a thread here and many thanks to https://github.com/baronomasia.

    1-使用 2-删除了自制的python安装版本

    2 - Removed the homebrew python installed version

    brew uninstall python
    

    3-重新安装您的Xcode命令工具:

    3- Reinstall your Xcode command tools:

    sudo xcode-select --install
    

    4-升级自制软件,然后通过自制软件重新安装python:

    4- Upgrade homebrew and reinstall python through homebrew:

    brew update && brew reinstall python    
    

    这篇关于OSx更新后如何修复损坏的python 2.7.11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆