Linux (Redhat) Install Python virtual environment

Source: Internet
Author: User
Tags virtual environment

Wow! Installation is very annoying Ah, the last discovery is the cause of their own network. Meditation Summary!!!

Python is 3.6

CentOS 6 64-bit

1. Install Python

80170471

2. Install Pip
wget https://bootstrap.pypa.io/get-pip.py--no-check-certificateget-pip.py

May be error!!! Such as:

PIP is configured with locations that require TLS/SSL and however the SSL module in Python are not available.

Execute Python and go to the Python command line:

It may also be an error.

Import SSL
Traceback (most recent ):
File "", line 1, in
File "/usr/local/python27/lib/python27/ssl.py", line.
Import _ssl # If we can ' t import it, let the error propagate
Importerror: No module named _ssl

See if OpenSSL and Openssl-devel are installed

[Email protected] ~]# rpm-aq| grep OpenSSL OpenSSL-x.x.xe-x.xxxopenssl-devel-xxx-xxx

If you don't have these two bags, just install them honestly.

This is the installation code, but there will still be an error, my goodness.

This is the Yum command for Linux that uses Python as the command interpreter, and we've upgraded Python from 2 of Linux to 3.

Workaround:

A. Upgrade yum, forget it, it's too much trouble.

B. Locate Usr/bin/yum, and open the change the first line "#!/usr/bin/python" to "#!/usr/bin/python2.6". 2.6 is my own version of Linux

The next step is to install the missing package above again, OpenSSL and Openssl-devel.

3. Re-compile Python (reload)

Some need to change the vi/usr/software/python-3.6.3/modules/setup, but I didn't find it, and I could finally

 for Sockets (2  for out of the other sockets line above, and possibly edit the SS L variable:ssl=/usr/local/-duse_ssl-i$ (SSL)/include-i$ (SSL)/include/-l$ (SSL)/lib-lssl- Lcrypto

and then recompile.

4. The next step is to execute the Python get-pip.py, of course, you can test the 2nd

After installation, use PIP-V error, as follows:
Bash:pip:command not found ...
What about this time??
Make a soft connection:
First check the installation path:
Find/-name Pip
Then make a soft connection
Ln-sv/usr/local/python/bin/pip/usr/bin/pip
You can use it when you're done.

5. The next simple

A. Installing a virtual environment

Pip Install Virtualenv

Pip Install Virtualenvwrapper (expansion pack for managing virtual Environments)

# Create a folder to save the virtual environment

mkdir ~/envs

sudo vi ~/.BASHRC

# Add the following two lines

Export Workon_home=~/envs (if not written there will be a read-write permission issue)

source/usr/local/bin/virtualenvwrapper.sh

# Run Source ~/.BASHRC

B. Use

# NEW

Mkvirtualenv-p (Python version) name (created virtual environment can be found in the path folder set above)

# Select

Workon Name

# Delete

Rmvirtualenv Name

# exit

Deactivate

Summary: The creation of virtual environments is necessary, but due to the improper operation of the upgrade Python it is easy to cause version conflicts

So there are a variety of problems, on the back of the work caused by the impact, so be sure to pay attention.

Linux (Redhat) Install Python virtual environment

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.