anaconda、jupyter、apache、mod_wsgi
anaconda含有一个版本的Python解释器,通常新版anaconda包含的解释器也非常新,前几天下载的conda 4.10.1,内含Python 3.8.8。
它还可以指向多个版本的解释器,每次新建环境时复制这个解释器;但是操蛋的是,anaconda所著称的数据处理科学包及其依赖项仅仅存在于base这个环境,新建环境时都要重新下载。那么只能使用base环境了?或者克隆base?
我突然想能否远程使用anaconda,从而发现了Jupyter notebook这个包,它提供web服务,配合Ipython和Python解释器,实现远程代码调试。
使用jupyter notebook这个python第三方包,需要先import一些什么,生成jupyter notebook的配置文件、设置密码,之后在配置文件中添加密码(sha1密文)、设置监听端口和远程ip限制这些。
jupyter notebook可以远程管理服务器的任何文本文件,特别的是调用Python解释器的脚本和调试记录,后者notebook的后缀是一个奇怪的名称(.ipynb ---IPython notebook)。
jupyter notebook可以支持用LaTex文档生成LaTex排版的内容?是调用LaTex的编译器而非Python吗?——我大概看了一下,用的是Python的LaTex包,jupyter notebook可以把排版后的内容回显在输入的LaTex文档(命令)下面。
Apache不需要安装,解压缩即可,默认(比如):C:\Apache24,这样会有很多好处,可以将web文件的根目录在conf文件中指向其他地方。如果不想解压缩到C盘,需要在conf文件中把C:\Apache24改为D:\Apache24
在压缩文件的最外层有一个ReadMe.txt,里面有解压缩、启动、启动服务的帮助。
install ------- You must first install the Visual C++ Redistributable for Visual Studio 2015-2019 x64. Download and Install, if you have not done so already, see: https://www.apachelounge.com/download/ Unzip the Apache24 folder to c:/Apache24 (that is the ServerRoot in the config). The default folder for your your webpages is DocumentRoot "c:/Apache24/htdocs" When you unzip to an other location: change Define SRVROOT "c:/Apache24" in httpd.conf, for example to "E:/Apache24" Run and test ------------ Open a command prompt window and cd to the c:\Apache24\bin folder. To Start Apache in the command prompt type: >httpd.exe Press Enter. If there are any errors it will tell you. Warnings will not stop Apache from working, they do need to be addressed none the less. If there are no errors the cursor will sit and blink on the next line. You can test your installation by opening up your Browser and typing in the address: http://localhost You can shut down Apache by pressing Ctrl+C (It may take a few seconds) To install as a service. Open command prompt as Administrator and type: >httpd.exe -k install You can start/stop the service with the command: >services.msc To see all Command line options: >httpd -h ApacheMonitor: Double click ApacheMonitor.exe, or put it in your Startup folder.
使用Apache配合WSGI,有一个比较出名的包叫做mod_wsgi。按照官方文档pypi中的文档:https://pypi.org/project/mod-wsgi/ 可以使用pip install mod_wsgi安装到Python中,也可以下载mod_wsgi.so到Apache中。我在pip install mod_wsgi时发现下载完成了,但是安装失败,在文档中细看,是要设置MOD_WSGI_APACHE_ROOTDIR这个环境变量,并且值为:D:/Apache24(顺斜杠)。
依然失败,错误原因为缺少MSVC++ 14.0版本或之上的组件,这个我一直搞不定。下载了MS C++生成工具,不会使用。之前用360进行安装,导致系统莫名产生很多问题。
还好在印象笔记中我记录了几年前的安装要点,https://www.lfd.uci.edu/~gohlke/pythonlibs/这个网站收集了几乎全部的Python的已编译好的包。我下载了符合Python3.8的wheel文件。
pip install xxx.whl,需要提前有wheel这个包,需要在命令行中cd到xxx.whl文件所在的位置。
安装成功,尚未调试。
浙公网安备 33010602011771号