Create a python server environment

1. Create a server

To choose a suitable cloud server platform, buy one of their own server

2. Download python

Query system installed python version

ls -l /usr/bin/python*
apt-get python3

3. The python3 as the default python

Method 1:

# 系统中python默认版本为python2.7,可以将其修改为python3
# 第一步:先删除python
rm -rf /usr/bin/python
# 第二步:创建软链接
ln -s /usr/bin/python3 /usr/bin/python
# 第三步:查看python版本是否修改为python3
python -V

法2:
https://blog.csdn.net/langb2014/article/details/78919562/

Using the update-alternatives switch channels

1. First check whether there are options on the python
$ update-alternatives --display python
一般为无
2. Establish python groups, and add Python3 of options (the default is python2)
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1(这里后面的1是优先级)

At this point you query the python version or 2, because the default settings are not modified

$ sudo update-alternatives --config python
输入这行代码之后,他会让你选择号码,你就按1就好,因为刚刚创建的优先级就是1

4.pip mismatch:

When you use the pip, the method appears mismatch can use the following

sudo apt-get remove python-pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
hash -r

Download python 5.1 of Creation Environment

https://blog.csdn.net/langb2014/article/details/78919562/ Ibid.

$ sudo pip install virtualenvwrapper

$ mkvirtualenv -p python3 (环境名)

5.2.解决mkvirtualenv: command not found

https://blog.csdn.net/Ayue1220/article/details/91359119

cd ~/
vim .bashrc

# 在最后面加上下面代码
export WORKON_HOME=~/.environments
source /usr/local/bin/virtualenvwrapper.sh

# 按: wq退出
重启一下
source ~/.bashrc

6. solve pip change the source list and Error

https://blog.csdn.net/wls666/article/details/95456309

cd ~
mkdir .pip
vim pip.conf

出入一下代码
[list]
format=columns

[global]
timeout = 6000
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com

# 源可以自行选择

If you would like more information about the python, python and want to play a small program created can be concerned about the public micro-channel number (dreamspy). Together we change the world with a python, with the dream of creating a python.Here Insert Picture Description

Published 64 original articles · won praise 14 · views 9189

Guess you like

Origin blog.csdn.net/jiangSummer/article/details/104064801