Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install virtualenv and virtualenvwrapper in raspberry pie 3b

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report