我需要在Django生产网站上将Python从3.6升级到3.7。当我使用python3.7 -m venv venv
创建新的venv并在其中安装Django时,一切正常,我可以启动开发服务器,甚至可以毫无问题地从服务器向它提出请求。但是当我将apache2与mod_python一起使用时,日志显示未安装Django。我可以交换两个venv,并且可以使用Python3.6交换,所以我不认为这是一个Apache配置问题。
当我使用Python3.7创建Venv时,它将创建到/usr/bin/python3.7
的符号链接,但是当我使用python3.6时,它将创建一个新的可执行文件。我认为这可能是个问题,但我没有找到证明的方法。
Venv创作:
root@localhost:~# python3.7 -m venv venv
root@localhost:~# ls -la venv/bin/
total 40
drwxr-xr-x 2 root root 4096 Jun 12 19:46 .
drwxr-xr-x 6 root root 4096 Jun 12 19:46 ..
-rw-r--r-- 1 root root 2186 Jun 12 19:46 activate
-rw-r--r-- 1 root root 1242 Jun 12 19:46 activate.csh
-rw-r--r-- 1 root root 2394 Jun 12 19:46 activate.fish
-rwxr-xr-x 1 root root 242 Jun 12 19:46 easy_install
-rwxr-xr-x 1 root root 242 Jun 12 19:46 easy_install-3.7
-rwxr-xr-x 1 root root 214 Jun 12 19:46 pip
-rwxr-xr-x 1 root root 214 Jun 12 19:46 pip3
-rwxr-xr-x 1 root root 214 Jun 12 19:46 pip3.7
lrwxrwxrwx 1 root root 9 Jun 12 19:46 python -> python3.7
lrwxrwxrwx 1 root root 9 Jun 12 19:46 python3 -> python3.7
lrwxrwxrwx 1 root root 18 Jun 12 19:46 python3.7 -> /usr/bin/python3.7
root@localhost:~# ls -la venv2/bin/
total 4528
drwxr-xr-x 3 root root 4096 Jun 12 19:47 .
drwxr-xr-x 5 root root 4096 Jun 12 19:47 ..
drwxr-xr-x 2 root root 4096 Jun 12 19:47 __pycache__
-rw-r--r-- 1 root root 2089 Jun 12 19:47 activate
-rw-r--r-- 1 root root 1116 Jun 12 19:47 activate.csh
-rw-r--r-- 1 root root 2190 Jun 12 19:47 activate.fish
-rw-r--r-- 1 root root 8321 Jun 12 19:47 activate.ps1
-rw-r--r-- 1 root root 1143 Jun 12 19:47 activate_this.py
-rwxr-xr-x 1 root root 250 Jun 12 19:47 chardetect
-rwxr-xr-x 1 root root 292 Jun 12 19:47 django-admin
-rwxr-xr-x 1 root root 151 Jun 12 19:47 django-admin.py
-rwxr-xr-x 1 root root 260 Jun 12 19:47 easy_install
-rwxr-xr-x 1 root root 260 Jun 12 19:47 easy_install-3.6
-rwxr-xr-x 1 root root 243 Jun 12 19:47 markdown_py
-rwxr-xr-x 1 root root 242 Jun 12 19:47 pip
-rwxr-xr-x 1 root root 242 Jun 12 19:47 pip3
-rwxr-xr-x 1 root root 242 Jun 12 19:47 pip3.6
-rwxr-xr-x 1 root root 248 Jun 12 19:47 pisa
lrwxrwxrwx 1 root root 7 Jun 12 19:47 python -> python3
-rwxr-xr-x 1 root root 2348 Jun 12 19:47 python-config
-rwxr-xr-x 1 root root 4522328 Jun 12 19:47 python3
lrwxrwxrwx 1 root root 7 Jun 12 19:47 python3.6 -> python3
-rwxr-xr-x 1 root root 234 Jun 12 19:47 rq
-rwxr-xr-x 1 root root 234 Jun 12 19:47 rqinfo
-rwxr-xr-x 1 root root 238 Jun 12 19:47 rqworker
-rwxr-xr-x 1 root root 245 Jun 12 19:47 sqlformat
-rwxr-xr-x 1 root root 238 Jun 12 19:47 wheel
-rwxr-xr-x 1 root root 248 Jun 12 19:47 xhtml2pdf