Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to install virtualenv and virtualenvwrapper in raspberry pie 3b

Shulou Source: shulou.com Published: 2022-06-01 23:00:42 09月24日 Update

Raspberry pie 3b how to install virtualenv and virtualenvwrapper, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Install virtualenv and virtualenvwrapper on raspberry pie 3b and find a bit of a pit. Record it.

On my raspberry pie, there are both python2.7 and python3.5

Installation

Run the command:

Sudo apt-get install virtualenvsudo apt-get install virtualenvwrapper

Ps: or use pip3 installation, pip3 installation must use sudo permissions, otherwise there will be some inexplicable circumstances.

Sudo pip3 install virtualenv virtualenvwrapper

Configure virtualenvwrapper

Add the following command to the end of adding ~ / .bashrc

# export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3export WORKON_HOME=$HOME/.virtualenvssource / usr/share/virtualenvwrapper/virtualenvwrapper.sh

Then run:

Source / .bashrc

So the installation of virtualenvwrapper is complete.

Ps:

Export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

For the coexistence of python2.7 and 3.5, you have to tell virtualenvwrapper to have a default python, which is generally set by linux systems.

If you use apt-get installation:

But in raspberry pie, after setting this environment variable, it inexplicably reported an error when creating a virtual environment. There will be no problem if this line is commented out. I wonder. Of course we have a way to specify the python version later.

Using pip3 installation, there is no such problem.

Use

Create an environment

Mkvirtualenv env1mkvirtualenv env2

After the environment is created, it automatically enters the directory and activates the environment.

Create the environment using the specified python version:

Mkvirtualenv-p / usr/bin/python3 py3env

Specify the path of python directly after the-p parameter

Note:

In other articles, including when I use other versions of Linux, type directly

Mkvirtualenv-p python3 py3env

It's fine, but in the raspberry pie system, he will only look for python3 in the current directory and report an error if he can't find it, not in the system environment variables. The path must be added. I don't know why.

Switching environment

Workon env1workon env2

List existing environment

Workon

Exit environment

Deactivate

Delete environment

Rmvirtualenv, after reading the above, have you mastered how to install virtualenv and virtualenvwrapper in raspberry pie 3b? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Environment raspberry problem variable version inexplicable content reason command method time more directory system path run at a loss for this parameters at the same time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi macOS Shulou Tech Info MySQL