Install Python module or package and pip to install the specified path as a non-root identity

Source: Internet
Author: User

Because you want to remotely access the company's servers without sudo permissions, you cannot install some Python packages in the default path (for example, a/usr/local/lib/-prefix path).

Generally use Easy_install or pip to install the default in Pathonpath site-packages below, such as/usr/lib64/python2.7/site-packages.

    1. With Pip
      pip install --user package_name

    2. With Easy_install
      easy_install --prefix=$HOME/local package_name

This will be installed into the $home/local/lib/pythonx.y/site-packages.

Don't forget that this path must be added to the environment variable pythonpath, or it will not be found after the import module.

    1. PIP Specifies the path:
sudo pip install six --upgrade --target="/usr/lib/python2.7/dist-packages"

When I install TensorFlow, I find Sys.path will find/usr/lib/python2.7/dist-packages first, but PIP is installed by default in/usr/local/... Below, so it is necessary to specify target, otherwise it may not be upgraded even if the library that was found in Python execution is still upgrade.

Small gift to go



McDull Fat Times
Links: https://www.jianshu.com/p/92a109ddf695
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.

Install Python module or package and pip to install the specified path as a non-root identity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.