Centos7 Install virtualenv Error bash: virtualenv: command not found…

After installing python3

1. Install virtualenv with PIP3

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenv

The above image has been installed successfully

2. Virtualenv: command not found

3. Add environment variable to solve the problem

(1) Using find/- name ‘ virtualenv.py ‘does it exist

It can be found in the figure below

(2) Add environment variable

Steps:

vim /etc/profile
# Add the following to the bottom of the file
PATH=$PATH:/usr/local/python3/bin

# is the command added to take effect
source /etc/profile

# Finally, check if the file was added successfully
echo $PATH

Example card:

(3)Reuse virtual env

# Use virtualenv to create a python3 environment with the command demo1
virtualenv --python=/usr/bin/python3 demo1
# Go to /demo1/bin under the virtual slow directory and start the virtual environment with the command
source activate

Similar Posts: