最近对Python有兴趣,在网上搜了《八天深入理解python》视频教程,由于用的mac,不用安装python,感觉瞬间开发环境就已经具备了,然后连个ipython都没装上,ps:还是只刚入手mac的菜鸟。
在终端,使用:sudo pip install ipython
- Exception:
- Traceback (most recent call last):
- File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
- status = self.run(options, args)
- File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 317, in run
- prefix=options.prefix_path,
- File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 736, in install
- requirement.uninstall(auto_confirm=True)
- File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 742, in uninstall
- paths_to_remove.remove(auto_confirm)
- File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
- renames(path, new_path)
- File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 267, in renames
- shutil.move(old, new)
- File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
- copytree(src, real_dst, symlinks=True)
- File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
- raise Error, errors
- Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-xR59WP-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]
报了一堆这样的错误
最后饶了一圈网上方法都说是系统保护(我还没对我的系统做过什么破坏性的事情)
按着:解除系统保护方法如下链接http://chaishiwei.com/blog/994.html
的方法试了好多次,电脑重启10来次,我就是没有实用工具,也是心累。
那么,改用PyCharm的IDE吧
问题来了:同样得导入第三方的包,别人都有file→setting,我这怎么就是没有。也是心累。
在这里记录一下,免得跟多人入坑
1、PyCharm→Preferences→Project:项目名→Project Interpreter
2、点击这个加号可以导入新的库,点击install,这里以requests库为例
3、查看是否已经存在
库已经导入了。
4、写个程序测试一下
- import requests
- res=requests.get('https://www.baidu.com')
- savefile=open("itcast.html","w")
- savefile.write(res.content)
- savefile.close()
生成文件并保存
原文地址:http://blog.csdn.net/zk673820543/article/details/52384134