Home  >  Q&A  >  body text

python - Using pip to install numpy shows satisfied. In the 2.6 sitepackage, how to install it separately for 2.7?

Like the title, centos, every time I want to use it, I use 2.7, but the result is that 2.7 is not available, and the installation shows that it has been installed. What should I do?

習慣沉默習慣沉默2686 days ago1074

reply all(4)I'll reply

  • 習慣沉默

    習慣沉默2017-06-12 09:24:46

    The final solution is

    1. Download the source code package of setuptools and pip

      setuptools源码包: https://pypi.python.org/pypi/setuptools
      pip源码包: https://pypi.python.org/pypi/pip#downloads
      
    2. Install setuptools and pip

      目前下载的版本是setuptools-36.0.1.zip与pip-9.0.1.tar.gz
      用tar/unzip命令解压, 格式:tar -xzvf pip-9.0.1.tar.gz/unzip -o -d /home/ setuptools-36.0.1.zip
      用cd打开该文件夹,格式:cd xxxx
      用python命令安装,格式:python setup.py install 
      
    3. pip install numpy

      此时python2.7的pip和numpy都装好了

    reply
    0
  • 巴扎黑

    巴扎黑2017-06-12 09:24:46

    As you can see, the pip you are using now is based on python2.6, so you need to reinstall a pip with python27, and make a soft connection of pip to the system environment variable to replace the old pip

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-06-12 09:24:46

    Thanks for the invitation. First tell me the reason for your situation. Because the default version of pip is associated with python2.6. You need to create a soft connection to pip of python2.7. Delete the pip of python2.6.

    If you are not very clear about this, then use another specific method:
    First uninstall the py2.7 you installed, and then find the path of python2.6's pip through which pip, and then delete the file (or rename it The document). Then install python2.7. Next time your pip will be the pip of py2.7

    reply
    0
  • 大家讲道理

    大家讲道理2017-06-12 09:24:46

    This is simple. I have several solutions. Let me explain slowly.
    1. Go to the site-packages directory of python2.6 and copy the numpy-related folders and egg files directly to the same directory of python2.7. It should also work.
    2. Of course, copying every time is annoying. First delete the pip in /usr/bin or /usr/local/bin, and then copy the pip file to /usr/bin or /usr under the script in the 2.7 directory. /local/bin.
    3. First delete pip under /usr/bin or /usr/local/bin, and then use soft link ln -s /xxx/xx/pip /usr/bin/pip #Create a symbolic link file pip of 2.6 pip
    4. Delete python, python2, and python2.7 under /usr/bin/ or /usr/local/bin, then find the 2.6 python, python2, and python2.6 programs, and copy them all to /usr/bin or / Under usr/local/bin
    5. Enter python2.6 on the command line, provided that python2.6 is in the directory of your environment variables. 6. Enter pip2.6 install numpy on the command line, provided that it is in the directory of your environment variables. There is pip2.6
    It’s up to you to choose, 5 and 6 are the easiest, don’t forget to like it if it’s easy to use

    reply
    0
  • Cancelreply