服务器上遇到的一些小问题,记录下来(如有更好的解决办法或者有错误恳请在评论区指正,感谢!)
文章目录
- 1. 添加环境无sudo权限:如本应该sudo vi /etc/local/.profile进行修改
- 2. 服务器装了anaconda,xshell连接时直接进入base环境,vncserver查到端口号后vncviewer连接不上,报错:unencrypted connection
- 3. linux服务器打开firefox浏览器出错:firefox is already running, but is not responding.
- 4. Python 使用pip install 时报错(WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, )
- 5. python setup.py install安装依赖时更换pip源
- 6. linux下执行xhost命令报错:unable to open display
- 7. 卸载 setup.py 安装 python 包
1. 添加环境无sudo权限:如本应该sudo vi /etc/local/.profile进行修改
解决:vim ./profile在自己目录下的profile里添加路径 export PATH=$PATH:……
2. 服务器装了anaconda,xshell连接时直接进入base环境,vncserver查到端口号后vncviewer连接不上,报错:unencrypted connection
解决:查看./bashrc文件(vim ./bashrc),如果文件有以下代码,注释掉,esc+:wq保存退出,终端输入source ~/.bashrc,修改生效
若连接还是报错:unable to contact settings server,重启就好
3. linux服务器打开firefox浏览器出错:firefox is already running, but is not responding.
解决:终端输入 killall firefox,再打开就可以
4. Python 使用pip install 时报错(WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, )
解决:
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
再运行 pip install
5. python setup.py install安装依赖时更换pip源
直接在setup.py的同目录放置一个setup.cfg:
[easy_install]
index_url = https://mirrors.aliyun.com/pypi/simple/
6. linux下执行xhost命令报错:unable to open display
[root@localhost ~]# vncserver
New 'localhost:1 (root)' desktop is localhost:1
Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost:1.log
[root@localhost ~]# export DISPLAY=localhost:1
[root@localhost ~]# xhost +
access control disabled, clients can connect from any host
7. 卸载 setup.py 安装 python 包
sudo python setup.py install --record files.txt
然后再进行手动删除
cat files.txt | xargs rm -rf