You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 6, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: doc/linux_ros_anaconda_warning.md
+40-5Lines changed: 40 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,11 +30,46 @@ $ source activate RoboND
30
30
```
31
31
And it should work! But in this case, you'll need to remember to do this each time you want to use your Anaconda Python install.
32
32
33
-
For a more permanent solution, you can add the `unset PYTHONPATH` line to your `.bashrc` file, but you need to make sure you drop it into the right location, after sourcing ROS. To do this, open your `.bashrc` file (should be located in your `~/` directory) and find the line that says `source /opt/ros/kinetic/setup.bash` and make this edit:
33
+
## Recommended ROS Approach
34
34
35
-
```
36
-
source /opt/ros/kinetic/setup.bash
37
-
unset PYTHONPATH
35
+
For a more permanent solution:
36
+
37
+
1. Install anaconda and choose not to add it to your path
38
+
2. Create a script named: ~/bin/cenv, with the following contents:
39
+
```
40
+
#!/bin/bash
41
+
unset PYTHONPATH
42
+
export PATH=$HOME/anaconda3/bin:$PATH
43
+
source activate $1
44
+
```
45
+
3. Login out and log back in to trigger the ~/bin path to be automatically added to your PATH variable.
46
+
Then you can run:
47
+
```
48
+
. cenv RoboND
49
+
```
50
+
anywhere on your system and it just works.
51
+
52
+
### Example
53
+
54
+
**Note "." is the same as "source" and is easier to type**
55
+
56
+
```sh
57
+
$ . /opt/ros/kinetic/setup.bash
58
+
$ which python
59
+
/usr/bin/python
60
+
$ echo$PYTHONPATH
61
+
/opt/ros/kinetic/lib/python2.7/dist-packages
62
+
$ . cenv RoboND
63
+
(RoboND) $ which python
64
+
~/anaconda3/envs/RoboND/bin/python
65
+
(RoboND) $ echo$PYTHONPATH
66
+
67
+
(RoboND) $ ipython
68
+
Python 3.5.2 | packaged by conda-forge | (default, Jan 19 2017, 15:28:33)
69
+
Type 'copyright', 'credits' or 'license'for more information
70
+
IPython 6.0.0 -- An enhanced Interactive Python. Type '?'for help.
71
+
72
+
In [1]: import cv2
38
73
```
39
74
40
-
See [this post](https://stackoverflow.com/questions/43019951/after-install-ros-kinetic-cannot-import-opencv) and [this post](https://stackoverflow.com/questions/17386880/does-anaconda-create-a-separate-pythonpath-variable-for-each-new-environment) for more information on the matter.
75
+
See [this post](https://stackoverflow.com/questions/43019951/after-install-ros-kinetic-cannot-import-opencv) and [this post](https://stackoverflow.com/questions/17386880/does-anaconda-create-a-separate-pythonpath-variable-for-each-new-environment) for more information on the matter.
0 commit comments