這裏我的問題有兩點。我試圖安裝BeautifulSoup,但面臨以下錯誤:安裝BeautifulSoup時出錯
Rahul-MacBook-Air:~ rahul$ sudo easy_install pip
Password:
Searching for pip
Best match: pip 8.1.2
Processing pip-8.1.2-py2.7.egg
pip 8.1.2 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin
Using /Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
Rahul-MacBook-Air:~ rahul$ pip install beautifulsoup4
Collecting beautifulsoup4
Using cached beautifulsoup4-4.5.1-py2-none-any.whl
Installing collected packages: beautifulsoup4
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 742, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/wheel.py", line 317, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/beautifulsoup4-4.5.1.dist-info'
有人可以告訴我我在做什麼錯在這裏?
我的下一個問題與前一個問題有關。我已經安裝了Python 3.5.2
>>> print(sys.version)
3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
>>>
但是在終端上就說明我一個不同的版本:
所以,當我嘗試安裝BeautifulSoup它開始指向到Python 2.7,我認爲是錯誤的。它應該指向最新的Python版本,即3.5.2
另外,我已經預裝了Python 2.7,編號爲/usr/bin/python
,Python 3.5.2安裝在/usr/local/bin/python
。 如何默認Python版本,使得每次我打開我的終端時它已經指向的Python 3.5.2
感謝, 拉胡爾
'權限被拒絕' – Jeon