我刚刚安装了 Anaconda(用于 ipython 笔记本——想运行一些 Pandas 程序)。它已成功安装,但这里的问题是每当我输入时which python,它总是使用默认的 python 作为/usr/bin/python
如果有人能告诉我如何将 anaconda python 设置为默认 python,那就太好了。到目前为止,我是菜鸟,我刚刚在默认路径中安装了 anaconda,如下所示~/anaconda3。
提前致谢。
我有一个运行 Ubuntu 16.04.6 LTS 的虚拟机。默认情况下Python 3.5.2
并且,我按照以下过程安装了 Python 3.8:
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar xzf Python-3.8.0
cd Python-3.8.0
sudo ./configure --enable-optimizations
sudo make altinstall
Run Code Online (Sandbox Code Playgroud)
由于我将安装 miniconda 并且我想避免任何冲突,我想知道如何卸载它。
到目前为止我已经尝试过:
sudo apt-get purge python3.8 AND
sudo apt-get --purge remove python3.8
Run Code Online (Sandbox Code Playgroud)
最后我错误地删除了包含它的文件夹:(
但我仍然拥有它。检查图像。
可以卸载吗?我以后会有什么问题吗?
谢谢
我有一个多年来一直用 Python 3 开发的软件。直到今天,我一直在使用 Ubuntu Desktop 11.04,但现在我想迁移到更高版本的 Ubuntu。
我是否必须继续使用 Ubuntu 11.04,这样我就不必因为更高版本的 Ubuntu 中的新变化而更改我软件的部分源代码?
最近的 Ubuntu 版本不会以任何方式影响我的软件吗?
$ sudo pip install numpy # or anything else
Run Code Online (Sandbox Code Playgroud)
错误:
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. (tried sudo -H, the rest errors persist)
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting numpy
Retrying (Retry(total=4, connect=None, read=None, …Run Code Online (Sandbox Code Playgroud) 我有一个使用 shebang 的第三方脚本#!/usr/bin/env python。
根据 python 文档,这是适用于 Python v2 和 Python v3 ( https://docs.python.org/3/using/windows.html#shebang-lines ) 的脚本的正确形式。
我的 Ubuntu (WSL) 只安装了 Python 3:
~? which python
~? which python3
/usr/bin/python3
Run Code Online (Sandbox Code Playgroud)
我已将此添加到路径中,方法是在我的内容中添加以下内容~/.bashrc并获取它
~? which python
~? which python3
/usr/bin/python3
Run Code Online (Sandbox Code Playgroud)
~? . ~/.bashrc
~? env | grep PATH
PATH=/home/me/.local/bin:/home/me/bin:/usr/bin/python3:/opt/gradle/gradle-5.3.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Run Code Online (Sandbox Code Playgroud)
然而,当我运行这个脚本时,它抱怨找不到 Python。我创建了一个简短的测试文件foo,其中包含相同的 shebang 和一个print("Hello"):
~? ./foo
/usr/bin/env: ‘python’: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我还能做些什么来env使用python3?
PS:我没有python 2,也不想安装它。第三方脚本的自述文件特别提到支持 Python v2 和 v3,并且根据 Python 文档本身,shebang 指出了这一点,如上所述。
PPS:添加别名并不能解决这个问题,因为它们仅在用户在提示符下调用 …
我最近将 18.04 版本升级到 20.04(早,我知道),并清除了我手动安装的“hplip”包(3.16.11)并安装了版本(3.20.3+dgfsg0-2)中的官方包。一切似乎都很好,直到我开始收到消息来更新我的驱动程序。确保我今天没有其他要打印的东西,我按照说明操作只是让“hp-plugin”命令无法使用以下回溯下载插件...
Traceback (most recent call last):
File "/usr/share/hplip/ui5/plugindialog.py", line 248, in NextButton_clicked
status, download_plugin_file, error_str = self.pluginObj.download(self.plugin_path,self.plugin_download_callback)
File "/usr/share/hplip/installer/pluginhandler.py", line 254, in download
core = core_install.CoreInstall()
File "/usr/share/hplip/installer/core_install.py", line 239, in __init__
self.passwordObj = password.Password(ui_mode)
File "/usr/share/hplip/base/password.py", line 88, in __init__
self.__readAuthType() # self.__authType
File "/usr/share/hplip/base/password.py", line 110, in __readAuthType
distro_name = get_distro_name().lower()
File "/usr/share/hplip/base/password.py", line 78, in get_distro_name
return distro.linux_distribution(full_distribution_name=False)[0]
File "/usr/lib/python3/dist-packages/distro.py", line 122, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/lib/python3/dist-packages/distro.py", line 677, in linux_distribution …Run Code Online (Sandbox Code Playgroud) 我只是尝试运行正常的更新/升级并收到此错误:
dpkg: warning: files list file for package 'libpython3.7-minimal:amd64' missing; assuming package has no files currently installed
(Reading database ... 141307 files and directories currently installed.)
Preparing to unpack .../libpython3.7-stdlib_3.7.13-1+focal3_amd64.deb ...
Unpacking libpython3.7-stdlib:amd64 (3.7.13-1+focal3) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.7-stdlib_3.7.13-1+focal3_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.7/distutils/__init__.py', which is also in package python3.7-distutils 3.7.13-1+focal1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libpython3.7-stdlib_3.7.13-1+focal3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
我尝试用谷歌搜索并查看此处,但我发现的最新解决方案不起作用。尝试运行损坏修复会导致:
dpkg: error processing …Run Code Online (Sandbox Code Playgroud) 在 Ubuntu 14.04 上,使用安装了 libapache2-mod-wsgi-py3 包的 Apache2 会在 /var/log/apache2/error.log 中出现错误
重现的方法很简单:
sudo apt-get install apache2
sudo service apache2 restart
# /var/log/apache2/error.log is "clean"
sudo apt-get install libapache2-mod-wsgi-py3
sudo service apache2 restart
Run Code Online (Sandbox Code Playgroud)
/var/log/apache2/error.log 给出以下错误:
[Mon Jan 05 16:51:53.641332 2015] [:error] [pid 3141:tid 140703516379008] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>
[Mon Jan 05 16:51:53.643563 2015] [:error] [pid 3141:tid 140703516379008] Traceback (most recent call last):
[Mon Jan 05 16:51:53.643633 2015] [:error] [pid 3141:tid 140703516379008] File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown
[Mon Jan …Run Code Online (Sandbox Code Playgroud) 当我试图安装python3-dev使用sudo apt-get install python3-dev我得到了以下信息
python3-dev : Depends: libpython3-dev (= 3.4.0-0ubuntu2) but it is not going to be installed
Depends: python3.4-dev (>= 3.4.0-0~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)
所以我尝试安装依赖项libpython3-dev然后我收到了这条消息
The following packages have unmet dependencies:
libpython3.4-dev : Depends: libpython3.4-stdlib (= 3.4.0-2ubuntu1.1) but 3.4.3-1ubuntu1~14.04.1 is to be installed
Depends: libpython3.4 (= 3.4.0-2ubuntu1.1) but 3.4.3-1ubuntu1~14.04.1 is to be installed
E: Unable to correct problems, …Run Code Online (Sandbox Code Playgroud) 我最近在我的 ubuntu 20.04 中安装了 python 3.10。我的安装步骤是:
apt install python3.10
apt install python3.10-dev
apt install python3.10-distutils
Run Code Online (Sandbox Code Playgroud)
问题是关于pip. 当我尝试安装任何错误时它崩溃:
ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)
Run Code Online (Sandbox Code Playgroud)
我的系统上安装了python 版本3.6 - 3.9 。此问题仅出现在 python 版本中3.10。这个问题的原因和解决方法是什么?