11月3日
环境搭建完成了,继续学习python框架
总结一下自己现在的能力吧。后台×××面的python脚本是能够书写的,但是python界面方面的编程能力还大大的不足,python与数据库的结合能力也不够,接下来就学习这方面。
真是太奇怪了,做什么都是报下面的错误
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/response.py", line 242, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
想来想去,可能是因为在公司,网络做了限制,由于我们有一个×××连接,使用了×××之后,终于能够使pip来安装软件了。真是不容易。
不过公司的电脑就算配置了×××,也还是不能安装,估计公司的有线网络限制或者是其他限制吧。
pip install virtualenv
wulilideMacBook-Pro:workspace root# virtualenv --system-site-packages blog_project_venv
New python executable in /Users/wulili/workspace/blog_project_venv/bin/python
Installing setuptools, pip, wheel...done.
wulilideMacBook-Pro:workspace root# ls -l
total 0
drwxr-xr-x 7 root staff 238 Nov 4 15:15 blog_project_venv
wulilideMacBook-Pro:workspace root# cd blog_project_venv/
wulilideMacBook-Pro:blog_project_venv root# ls -l
total 16
lrwxr-xr-x 1 root staff 63 Nov 4 15:11 .Python -> /System/Library/Frameworks/Python.framework/Versions/2.7/Python
drwxr-xr-x 16 root staff 544 Nov 4 15:15 bin
drwxr-xr-x 3 root staff 102 Nov 4 15:11 include
drwxr-xr-x 3 root staff 102 Nov 4 15:11 lib
-rw-r--r-- 1 root staff 60 Nov 4 15:15 pip-selfcheck.json
wulilideMacBook-Pro:blog_project_venv root# cd bin
wulilideMacBook-Pro:bin root# ls -l
total 160
-rw-r--r-- 1 root staff 2100 Nov 4 15:15 activate
-rw-r--r-- 1 root staff 1042 Nov 4 15:15 activate.csh
-rw-r--r-- 1 root staff 2196 Nov 4 15:15 activate.fish
-rw-r--r-- 1 root staff 1137 Nov 4 15:15 activate_this.py
-rwxr-xr-x 1 root staff 269 Nov 4 15:14 easy_install
-rwxr-xr-x 1 root staff 269 Nov 4 15:14 easy_install-2.7
-rwxr-xr-x 1 root staff 241 Nov 4 15:14 pip
-rwxr-xr-x 1 root staff 241 Nov 4 15:14 pip2
-rwxr-xr-x 1 root staff 241 Nov 4 15:14 pip2.7
-rwxr-xr-x 1 root staff 25152 Nov 4 15:11 python
-rwxr-xr-x 1 root staff 2359 Nov 4 15:15 python-config
lrwxr-xr-x 1 root staff 6 Nov 4 15:11 python2 -> python
lrwxr-xr-x 1 root staff 6 Nov 4 15:11 python2.7 -> python
-rwxr-xr-x 1 root staff 248 Nov 4 15:14 wheel
wulilideMacBook-Pro:bin root#
wulilideMacBook-Pro:blog_project_venv root# source ./bin/activate
(blog_project_venv) wulilideMacBook-Pro:blog_project_venv root# which python
/Users/wulili/workspace/blog_project_venv/bin/python
(blog_project_venv) wulilideMacBook-Pro:blog_project_venv root#
(blog_project_venv) wulilideMacBook-Pro:blog_project_venv wulili$ deactivate --退出虚拟环境
wulilideMacBook-Pro:blog_project_venv wulili$ pwd
/Users/wulili/workspace/blog_project_venv
转载于:https://blog.51cto.com/10983441/1868824