我的pyhton2.7安裝在/ usr/local/lib中。 如果我輸入which python2.7
,我可以有/usr/local/bin/python2.7
。 後來我設定在〜/ .bashrc PYTHONPATH作爲如何設置python安裝路徑?
export PYTHONPATH="/usr/local/bin/python2.7:$PYTHONPATH"
我喜歡安裝PIP和虛擬環境。 然後嘗試作爲
sudo apt-get install python-pip python-dev python-virtualenv
我有錯誤,還在/usr/lib
尋找蟒蛇。錯誤是
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-dev is already the newest version.
python-pip is already the newest version.
python-virtualenv is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 362 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python2.7 (2.7.6-8ubuntu0.2) ...
python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory
dpkg: error processing package python2.7 (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
python2.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
如何正確設置python路徑?
編輯: 我回聲$ PATH給
/usr/local/bin:/usr/local/cuda-8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/bin/python2.7
回聲$ PYTHONPATH給
/home/coie/Softwares/apollocaffe/python:/usr/local/bin/python2.7:
只是驗證,你的意思是'〜/ .bashrc'而不是'〜/ bashrc',對吧? –
對不起〜/ .bashrc – batuman