ubuntu python installation using a virtual environment virtualenv

1, the virtual environment is doing with?

I upload a cuda computer, graphics drivers, cudnn supporting documents such as a pile, and then rely on the gpu cuda driver installation and test version tensorflow2.0, I wonder why, every time I finish tf2 computer program will be stuck with and I could change the graphics card hardware related, but I do not want to unload heavy equipment, in case of a bad computer environment collapse I have to install it again from scratch, and consequently there is a computer system, think about it hard, so I plan to install a cpu debug version of tf2.0 first look. So this time the virtual environment is a good choice.

2, how to install?

I environment:

python --version    #python3.5.2

pip --version  #pip 19.3.1

sudo pip install virtualenv
sudo pip install virtualenvwrapper

After installation is complete always need a place to put virtualenvs related files and configuration, right?

# Create a virtual environment management directory
 mkdir ~ / .virtualenvs
# Add the virtual environment management directory to the current user's environment variables, in order to facilitate future directly into
# .Bashrc directly added at the following two lines, saving, and Source ~ / .bashrc or re-open a terminal
export WORKON_HOME=$HOME/.virtualenvs 
source /usr/local/bin/virtualenvwrapper.sh

3, to create a virtual environment

# Python to create the specified version of the virtual environment
mkvirtualenv -p / usr / bin / python # tf2_cpu attention python version, some computers will be python3

4, using

# Activate the virtual environment, the user name in front of the terminal after activation is successful there will be a (tf2_cpu) logo, that you present in a virtual environment
workon tf2_cpu

# Exit virtual environment
deactivate

# Delete a virtual environment, which I did not try
rmvirtualenv tf2_cpu

5, installed in the virtual environment dependencies

First, enter the virtual environment, followed by the installation:

pip install tensorflow==2.0.0-alpha0 -i https://pypi.douban.com/simple
pip install opencv-python -i https://pypi.douban.com/simple
pip install pandas -i https://pypi.douban.com/simple

# Be careful here, after the installation finished import tensorflow the error. This is supposed to do? It was followed by Ann

PIP install TF-Nightly -i HTTPS: // pypi.douban.com/simple 
# where there is error has reminded, operating through a bunch of packages installed, I do not quite understand, but not being given the import tensorflow
PIP install PANDAS # watercress source error, the error is not directly mounted, this is what action?
Python -m PIP install matplotlib # installation matplotlib, I do not know why this command and the other looks a little bit different

Then start your run. .

Guess you like

Origin www.cnblogs.com/0-lingdu/p/12214502.html