GVKun编程网logo

在Ubuntu18.04上使用Anaconda(ubuntu 18.04安装anaconda)

21

如果您对在Ubuntu18.04上使用Anaconda和ubuntu18.04安装anaconda感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解在Ubuntu18.04上使用Anaconda的

如果您对在Ubuntu18.04上使用Anacondaubuntu 18.04安装anaconda感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解在Ubuntu18.04上使用Anaconda的各种细节,并对ubuntu 18.04安装anaconda进行深入的分析,此外还有关于.htaccess文件不能在Ubuntu 14.04上使用apache2、php – 无法在Ubuntu 14.04上使用Apache 2.4启用mpm_prefork、Ubuntu 16.04上anaconda安装和使用教程,安装jupyter扩展等 | anaconda tutorial on ubuntu 16.04、ubuntu 18.04 安装anaconda的实用技巧。

本文目录一览:

在Ubuntu18.04上使用Anaconda(ubuntu 18.04安装anaconda)

在Ubuntu18.04上使用Anaconda(ubuntu 18.04安装anaconda)

启动Anaconda Navigator 图形化界面

$ source ~/anaconda3/bin/activate root
$ anaconda-navigator

查看目前的conda版本:

conda --version

 

 

 

使用conda 安装requirements.txt中包

conda install --yes --file requirements.txt

 

提高下载速度 

Anaconda 的镜像地址默认在国外,用 conda 安装包的时候会很慢,目前可用的国内镜像源地址是清华大学提供的。修改 ~/.condarc (Linux/Mac) 或 C:\Users\当前用户名.condarc (Windows) 配置

channels:
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
 - defaults
show_channel_urls: true

anaconda换源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ 
conda config --set show_channel_urls yes

上文中前两个属于anaconda python的基础免费仓库镜像,最后一个属于pytorch的仓库镜像。注意想要下载pytorch要加上第三个镜像地址。

pip换源

 除此之外,你也可以把 pip 的镜像源地址也换成国内的,豆瓣源速度比较快。修改 ~/.pip/pip.conf (Linux/Mac) 或 C:\Users\当前用户名\pip\pip.ini (Windows) 配置:

[global]
trusted-host =  pypi.douban.com
index-url = http://pypi.douban.com/simple

 

一 、环境管理(原因是很可能某个包不支持conda 默认的Python3.7 比如我tensorflow 不支持3.7)

1查看当前系统下的环境

conda env list

或者

conda info -e
conda info --envs

2.创建

# 指定python版本为3.6,注意至少需要指定python版本或者要安装的包

conda create -n env_name python=3.6
# 同时安装必要的包
conda create -n env_name numpy matplotlib python=3.6

我这里env_name 选择的是python3.6 

3.激活进入环境

conda activate python3.6

原来指令已经废弃

source activate python3.6

4.退出环境回到默认环境

conda deactivate

5 删除某些已经不需要的环境

conda remove -n env_name --all

 

 

二、包管理

给某个特定环境安装package有两个选择:

一是切换到该环境下直接安装

# 进入该环境
activate env_name

# 安装单独某个包
conda install pandas # 安装anaconda发行版中所有的包 conda install anaconda

 

# 安装 matplotlib 
conda install matplotlib
# 同时安装多个包
conda install numpy scipy pandas 
# 安装指定版本的包
conda install numpy=1.11  # 查看已安装的包 conda list # 包更新 conda update matplotlib # 删除包 conda remove matplotlib

 

二是安装时指定环境参数-n

conda install -n env_name pandas

 

查看已经安装的package

conda list
# 指定查看某环境下安装的package
conda list -n env_name

 

查找软件源里面的版本信息

conda search package

 

 
更新本地的包
conda update numpy
conda update anaconda

卸载包

conda remove numpy

 

 复制环境 

conda create --name <new_env_name> --clone <copied_env_name>

 

 

以上参考收集自

https://blog.csdn.net/sinat_38816924/article/details/88752817

 https://blog.csdn.net/u012151283/article/details/54145347

注意 虚拟环境最好使用python3.5 ,python3.6的spyder会不明原因报错 

.htaccess文件不能在Ubuntu 14.04上使用apache2

.htaccess文件不能在Ubuntu 14.04上使用apache2

我的.htaccess文件无法在我的Ubuntu 14.04上使用Apache 2。

这是我的文件:

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.PHP?pg=$1

我如何解决我的问题?

让.htaccess重写规则redirect到一个脚本“在当前目录”(而不是一个明确的path)

密码保护Flask应用程序中的一个网页

这是wordpress的.htaccess代码。 有人可以解释它是如何工作的?

CodeIgniter .htaccess – 500内部服务器错误/ index.PHP删除

在弹性beanstalk上configurationapache

从你的信息我只能猜测(“不行”不是很具体)。

很可能你没有启用mod_rewrite。 输入:

a2enmod rewrite

之后重启Apache:

service apache2 restart

第一步打开文件为

sudo vim /etc/apache2/apache2.conf

第二步删除注释符号(#),如果您在此行(行号大约187)之前找到它AccessFileName .htaccess

第三步然后找到有哪些行选项索引FollowSymLinks AllowOverride无需要所有授予

用“全部”替换“无”

AllowOverride全部

.htaccess它的作品!

如果其Ubuntu LAMP全新安装,则可以通过以下步骤进行跟进。 它只是从以上几点总结:

步骤1:

如果你有Ubuntu的服务器的sudo访问,打开apache2.conf文件

root@etc/apache2$ vi apache2.conf

第2步:

Change Directory /var/www/ from AllowOverride None to AllowOverride All share the file permission level for .htaccess from denied to granted

第3步:

Change the same settings in root@etc/apache2/sites-enabled/$ vi 000-default.conf file

步骤4:

运行a2enmod rewrite

这一步真的很重要。 它会提示您重新启动服务器。

第5步:重新启动服务器

service apache2 restart

如果上述步骤失败运行

sudo /etc/init.d/apache2 restart

如果您在apache2上使用最新版本,则需要在/etc/apache2/sites-available/000-default.conf中添加以下行

你需要在这个标签里添加下面的内容

选项索引FollowSymLinks MultiViews AllowOverride All Order允许,拒绝全部允许

之后运行“service apache2 restart”

总结

以上是小编为你收集整理的.htaccess文件不能在Ubuntu 14.04上使用apache2全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

php – 无法在Ubuntu 14.04上使用Apache 2.4启用mpm_prefork

php – 无法在Ubuntu 14.04上使用Apache 2.4启用mpm_prefork

我在Ubuntu 14.04上用Apache 2.4安装 PHP 5.4.
apt-get上没有PHP 5.4,所以我必须从源代码安装它.
我安装了
apache2-prefork-dev
apache2-mpm-prefork

我用PHP配置了

./configure --with-apxs2=/usr/bin/apxs2 --with-MysqL --with-curl

然后我构建并安装.我将这些行添加到/etc/apache2/apache2.conf:

LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_prefork.so
LoadModule PHP5_module  modules/libPHP5.so
AddType application/x-http-PHP  .PHP

当我尝试重新启动Apache时,我收到此错误:

module mpm_event_module is already loaded,skipping

我在.conf文件中搜索,但之前没有加载模块.
编辑:

正如@Andrew Schulman的答案,我可以找到它

/etc/apache2/mods-available/mpm_event.load

当我跑

a2enmod mpm_event

我明白了:

Considering conflict mpm_worker for mpm_event:
Considering conflict mpm_prefork for mpm_event:
Considering conflict mpm_itk for mpm_event:

我该如何解决冲突?

EDIT2:

我用了

a2dismod

mpm_event_module

并加载了mpm_prefork_module. Apache重启确定,但是当我尝试运行时

a2enmod mpm_prefork_module

我明白了:

ERROR: Module mpm_prefork_module does not exist!

这是什么意思?

您可以通过浏览整个Apache配置来找到它:
grep -r mpm_event_module /etc/apache2

它几乎肯定在/etc/apache2/mods-available/mpm_event.load中.在Debian / Ubuntu中,启用和禁用Apache模块的标准方法是运行例如

a2dismod mpm_event
a2enmod mpm_prefork

见man a2enmod,同样是man a2enconf和man a2ensite.

Ubuntu 16.04上anaconda安装和使用教程,安装jupyter扩展等 | anaconda tutorial on ubuntu 16.04

Ubuntu 16.04上anaconda安装和使用教程,安装jupyter扩展等 | anaconda tutorial on ubuntu 16.04

本文首发于个人博客https://kezunlin.me/post/23014ca5/,欢迎阅读最新内容! anaconda tutorial on ubuntu 16.04

<!--more-->

Guide

versions:

  • ubuntu 16.04
  • conda 4.6.14
  • python 3.7.3 (default)
  • python 3.5.6 (env)

Install Conda

download Anaconda3-2019.03-Linux-x86_64.sh from here

bash ./Anaconda3-2019.03-Linux-x86_64.sh

output

[/home/kezunlin/anaconda3] >>> 
PREFIX=/home/kezunlin/anaconda3
installing: python-3.7.3-h0371630_0 ...
Python 3.7.3
...
installing: scikit-image-0.14.2-py37he6710b0_0 ...
installing: scikit-learn-0.20.3-py37hd81dba3_0 ...
installing: astropy-3.1.2-py37h7b6447c_0 ...
installing: statsmodels-0.9.0-py37h035aef0_0 ...
installing: seaborn-0.9.0-py37_0 ...
installing: anaconda-2019.03-py37_0 ...
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]

If you''d prefer that conda''s base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false

Thank you for installing Anaconda3!

conda config --set auto_activate_base false

check version

conda --version
conda 4.6.11

conda update conda

conda --version
conda 4.6.14

Managing Environments

create new env

When you begin using conda, you already have a default environment named base. You don''t want to put programs into your base environment, though. Create separate environments to keep your programs isolated from each other.

(base) kezunlin[@ke](https://my.oschina.net/u/188042):~$ conda --version
conda 4.6.14

(base) kezunlin[@ke](https://my.oschina.net/u/188042):~$ conda create --name snowflakes biopython
(base) kezunlin[@ke](https://my.oschina.net/u/188042):~$ conda activate snowflakes
(snowflakes) kezunlin[@ke](https://my.oschina.net/u/188042):~$ 
(snowflakes) kezunlin[@ke](https://my.oschina.net/u/188042):~$ conda deactivate
(base) kezunlin@ke:~$ 

conda activate only works on conda 4.6 and later versions.

list envs

conda info --envs
# conda environments:
#
base                  *  /home/kezunlin/anaconda3
snowflakes               /home/kezunlin/anaconda3/envs/snowflakes

~/.conda/environments.txt

/home/kezunlin/anaconda3
/home/kezunlin/anaconda3/envs/snowflakes
/home/kezunlin/anaconda3/envs/py35

Managing Python

When you create a new environment, conda installs the same Python version you used when you downloaded and installed Anaconda. If you want to use a different version of Python, for example Python 3.5, simply create a new environment and specify the version of Python that you want.

conda create --name snakes python=3.5
conda activate py35

conda info --envs
# conda environments:
#
base                     /home/kezunlin/anaconda3
py35                  *  /home/kezunlin/anaconda3/envs/py35
snowflakes               /home/kezunlin/anaconda3/envs/snowflakes

(base) kezunlin@ke:~$ python --version
Python 3.7.3
(base) kezunlin@ke:~$ conda activate py35
(py35) kezunlin@ke:~$ python --version
Python 3.5.6 :: Anaconda, Inc.

Managing packages

list packages

(base) kezunlin@ke:~$ conda activate py35
(py35) kezunlin@ke:~$ 
(py35) kezunlin@ke:~$ conda list
# packages in environment at /home/kezunlin/anaconda3/envs/py35:
#
# Name                    Version                   Build  Channel
ca-certificates           2019.1.23                     0  
certifi                   2018.8.24                py35_1  
libedit                   3.1.20181209         hc058e9b_0  

search

conda search beautifulsoup4

...
beautifulsoup4                 4.6.3          py27_0  pkgs/main           
beautifulsoup4                 4.6.3          py35_0  pkgs/main           
beautifulsoup4                 4.6.3          py36_0  pkgs/main           
beautifulsoup4                 4.6.3          py37_0  pkgs/main           
beautifulsoup4                 4.7.1          py27_1  pkgs/main           
beautifulsoup4                 4.7.1          py36_1  pkgs/main           
beautifulsoup4                 4.7.1          py37_1  pkgs/main      

install

conda install beautifulsoup4

conda config

conda config --set show_channel_urls yes
conda config --show

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<!-- kzl in-article ad -->

<insdata-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-5653382914441020" data-ad-slot="7925631830"></ins>

<script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>

Tools

Jupyter notebook

install jupyter

conda create -n py35 python=3.5
conda activate py35
conda install jupyter

install kernel

python -m ipykernel install --user --name=py35
Installed kernelspec py35 in /home/kezunlin/.local/share/jupyter/kernels/py35

jupyter depends on notebook and ipykernel also see tensorflow jupyter notebook kenel

run jupyter

jupyter notebook

now we can see py35 kernel appears.

py35 kernel

tensorflow-gpu/keras

conda activate py35
conda install tensorflow-gpu keras

test

 >>>import tensorflow as tf
 >>>import keras as K
 Using TensorFlow backend.

.keras/keras.json

{
    "epsilon": 1e-07, 
    "floatx": "float32", 
    "image_data_format": "channels_last", 
    "backend": "tensorflow"
}

pytorch

see pytorch tutorial on ubuntu 16.04

Reference

  • getting-started with conda
  • conda command ref

History

  • 20190524: created.

Copyright

  • Post author: kezunlin
  • Post link: https://kezunlin.me/post/23014ca5/
  • Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.

ubuntu 18.04 安装anaconda

ubuntu 18.04 安装anaconda

##ubuntu 安装anaconda 4版本

为了学习 tensorflow python3.5 版本 使用anaconda

###安装:

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 清华大学镜像 里面下载 官网我这网络打不开。。。

对应的版本就行 可以百度一下

下来 照着 安装就行

###设置环境变量:

export PATH=/root/anaconda2/bin:$PATH

vim /root/.bashrc

source /root/.bashrc

###查看安装版本

conda -V

###查看可用包列表 conda list 列表有则成功

##查找可用版本

现在的版本是python2.7 更换版本

conda search "^python$"

python                       1.0.1                         0  defaults        
                             2.6.8                         1  defaults        
                             2.6.8                         2  defaults        
                             2.6.8                         3  defaults        
                             2.6.8                         4  defaults        
                             2.6.8                         5  defaults        
                             2.6.8                         6  defaults        
                             2.6.8                         7  defaults        
                             2.6.9                         0  defaults        
                             2.6.9                         1  defaults        
                             2.7.3                         2  defaults        
                             2.7.3                         3  defaults        
                             2.7.3                         4  defaults        
                             2.7.3                         5  defaults        
                             2.7.3                         6  defaults        
                             2.7.3                         7  defaults        
                             2.7.4                         0  defaults        
                             2.7.5                         0  defaults        
                             2.7.5                         1  defaults        
                             2.7.5                         2  defaults        
                             2.7.5                         3  defaults        
                             2.7.6                         0  defaults        
                             2.7.6                         1  defaults        
                             2.7.6                         2  defaults        
                             2.7.7                         0  defaults        
                             2.7.7                         2  defaults        
                             2.7.8                         0  defaults        
                             2.7.8                         1  defaults        
                             2.7.9                         0  defaults        
                             2.7.9                         1  defaults        
                             2.7.9                        d1  defaults        [debug]
                             2.7.9                         2  defaults        
                             2.7.9                        d2  defaults        [debug]
                             2.7.9                         3  defaults        
                             2.7.10                        0  defaults        
                             2.7.10                       d0  defaults        [debug]
                             2.7.10                        1  defaults        
                             2.7.10                        2  defaults        
                             2.7.11                        0  defaults        
                             2.7.11                       d0  defaults        [debug]
                             2.7.11                        5  defaults        
                             2.7.12                        0  defaults        
                          *  2.7.12                        1  defaults        
                             2.7.13                        0  defaults        
                             3.3.0                      pro0  defaults        
                             3.3.0                      pro1  defaults        
                             3.3.0                         2  defaults        
                             3.3.0                         3  defaults        
                             3.3.0                         4  defaults        
                             3.3.1                         0  defaults        
                             3.3.2                         0  defaults        
                             3.3.2                         1  defaults        
                             3.3.3                         0  defaults        
                             3.3.4                         0  defaults        
                             3.3.5                         0  defaults        
                             3.3.5                         1  defaults        
                             3.3.5                         2  defaults        
                             3.3.5                         3  defaults        
                             3.3.5                         4  defaults        
                             3.4.0                         0  defaults        
                             3.4.1                         0  defaults        
                             3.4.1                         1  defaults        
                             3.4.1                         2  defaults        
                             3.4.1                         3  defaults        
                             3.4.1                         4  defaults        
                             3.4.2                         0  defaults        
                             3.4.3                         0  defaults        
                             3.4.3                         1  defaults        
                             3.4.3                         2  defaults        
                             3.4.4                         0  defaults        
                             3.4.4                         5  defaults        
                             3.4.5                         0  defaults        
                             3.5.0rc4                      0  defaults        
                             3.5.0                         0  defaults        
                             3.5.0                         1  defaults        
                             3.5.1                         0  defaults        
                             3.5.1                         5  defaults        
                             3.5.2                         0  defaults        
                             3.5.3                         0  defaults        
                             3.5.3                         1  defaults        
                          .  3.5.4                         0  defaults        
                             3.6.0                         0  defaults        
                             3.6.1                         0  defaults        
                             3.6.1                         2  defaults        
                          .  3.6.2                         0  defaults

安装可用环境

conda create --name my_env python=3

激活新环境

source activate my_env

停用环境

source deactivate

安装python3.5版本

conda create -n my_env35 python=3.5

激活新环境 source activate my_env 停用 source deactivate

更新版本

conda update python=3.5.2

查看所有环境

conda info --envs

给环境安装其他软件包

conda install --name my_env35 numpy

删除环境变量

conda remove --name my_env --all

更新 anaconda

conda update conda

卸载Anaconda

conda install anaconda-clean --yes

rm -rf ~/anaconda3

vim ~/.bashrc

更换仓库镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --set show_channel_urls yes

关于在Ubuntu18.04上使用Anacondaubuntu 18.04安装anaconda的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于.htaccess文件不能在Ubuntu 14.04上使用apache2、php – 无法在Ubuntu 14.04上使用Apache 2.4启用mpm_prefork、Ubuntu 16.04上anaconda安装和使用教程,安装jupyter扩展等 | anaconda tutorial on ubuntu 16.04、ubuntu 18.04 安装anaconda的相关知识,请在本站寻找。

本文标签: